public static void ComputeKey(byte[] key, byte[] salt, int iterations, ComputeHmacCallback computeHmacCallback, int hmacLength, byte[] output) { using (Pbkdf2 kdf = new Pbkdf2 (key, salt, iterations, computeHmacCallback, hmacLength)) { kdf.Read(output); } }
public void Reopen(byte[] key, byte[] salt, int iterations, ComputeHmacCallback computeHmacCallback, int hmacLength) { Helper.CheckNull("key", key); Helper.CheckNull("salt", salt); Helper.CheckNull("computeHmacCallback", computeHmacCallback); Helper.CheckRange("salt", salt, 0, int.MaxValue - 4); Helper.CheckRange("iterations", iterations, 1, int.MaxValue); Helper.CheckRange("hmacLength", hmacLength, 1, int.MaxValue); _key = new byte[key.Length]; Array.Copy(key, _key, key.Length); _saltBuf = new byte[salt.Length + 4]; Array.Copy(salt, _saltBuf, salt.Length); _iterations = iterations; _computeHmacCallback = computeHmacCallback; _block = new byte[hmacLength]; _blockT1 = new byte[hmacLength]; _blockT2 = new byte[hmacLength]; ReopenStream(); }
public Pbkdf2(byte[] key, byte[] salt, int iterations, ComputeHmacCallback computeHmacCallback, int hmacLength) { Reopen(key, salt, iterations, computeHmacCallback, hmacLength); }
public static void ComputeKey(byte[] key, byte[] salt, int iterations, ComputeHmacCallback computeHmacCallback, int hmacLength, byte[] output) { using (Pbkdf2 kdf = new Pbkdf2(key, salt, iterations, computeHmacCallback, hmacLength)) { kdf.Read(output); } }