Skip to content

Instantly share code, notes, and snippets.

@charlesportwoodii
charlesportwoodii / HKDF.cs
Last active January 21, 2022 22:17
RFC 5869, HMAC-based Extract-and-Expand Key Derivation Function (HKDF) in C# for .Net Core
using System;
using System.Security.Cryptography;
class HKDF
{
public byte[] hash { get; set; }
private readonly HashAlgorithmName algorithm;
private readonly HMAC hmac;
private readonly int digestLength;
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEWErd6BYJKwYBBAHaRw8BAQdAhoJHTO0BCGvEfjLY2Mb26aduF3AyZHkigpMM
l/sLG3+0NkNoYXJsZXMgUi4gUG9ydHdvb2QgSUkgPGNoYXJsZXNwb3J0d29vZGlp
QGVyaWFubmEuY29tPoh+BBMWCAAmBQJYSt3oAhsDBQkJZgGABQsJCAcCBhUICQoL
AgMWAgECHgECF4AACgkQlPmB/MqRvoYz3AEA6oLX8vu96MXh2YlVZic6GYED6nnW
19iTPRE47Z6EbbgBANOs4ZExoEr8NAXW6sies6ziRrYd4lY66+4+WmLE5TEAiKEE
EBMKAAYFAlhK6h8ACgkQKHXXxzmOz8Q+AAIJAb1x2BBx0e72rOrdAfhmjlJzH5oS
RwdDezaKmnK0ziuKrcKjUevz96Z17nW01JPSQ5/y9XGHkKYJdvmp8MD/2xM+Agic
AB1qV0/rrhyu1FBrBsSHKOe0BmKyrBJ1v0uIUps04t9v9ftuTz6VR7jF4ecQSUOf
@charlesportwoodii
charlesportwoodii / README.md
Last active September 22, 2016 16:15
OpenSSL 1.0.2i, Cloudflare ChaChaPoly Configure Patch

OpenSSL 1.0.2i ChaCha Poly Configure Patch

Cloudflare's OpenSSL patch for ChaChaPoly doesn't apply cleanly on OpenSSL 1.0.2i. This minor patch fixes it:

cd openssl-1.0.2i
wget https://gist.githubusercontent.com/charlesportwoodii/9e95c6a4ecde31ea23c17f6823bdb320/raw/a02fac917fc30f4767fb60a9563bad69dc1c054d/chacha.patch
patch < chacha.patch
@charlesportwoodii
charlesportwoodii / HKDF.cs
Last active November 9, 2020 17:34
RFC 5869, HMAC-based Extract-and-Expand Key Derivation Function (HKDF) in C# for Universal Windows Platform (UWP)
/**
* Hash based KDF
* Implements RFC 5869 :: https://tools.ietf.org/html/rfc5869
*/
public class HKDF
{
/**
* The HMAC algorithm provider
* @var MacAlgoritimProvider provided
*/
@charlesportwoodii
charlesportwoodii / PBKDF.cs
Last active October 4, 2019 09:59
PBKDF2 Implementation in C# for Universal Windows Platform (UWP)
/**
* PBKDF algorithm
*/
class PBKDF
{
/**
* The algorithm to use
* @var string algorithm
*/
private string algorithm = KeyDerivationAlgorithmNames.Pbkdf2Sha256;

Keybase proof

I hereby claim:

  • I am charlesportwoodii on github.
  • I am charlesportwood (https://keybase.io/charlesportwood) on keybase.
  • I have a public key whose fingerprint is 77D4 529F 2CEF B65F 8780 86F1 2875 D7C7 398E CFC4

To claim this, I am signing this object: