Skip to content

Instantly share code, notes, and snippets.

View simontime's full-sized avatar
🥨

Simon Aarons simontime

🥨
View GitHub Profile
@simontime
simontime / pbkdf2.cs
Created October 24, 2018 12:50
PBKDF2 key derivation algorithm in C#
private static byte[] PBKDF2(int Len, byte[] Passphrase, byte[] Salt, int IterCount)
{
using (var HMAC = new HMACSHA256(Passphrase))
{
byte[] ExtKey = new byte[Salt.Length + 4];
Buffer.BlockCopy(Salt, 0, ExtKey, 0, Salt.Length);
using (var Strm = new MemoryStream())
{
for (int i = 0; i < Len >> 5; i++)