internal PBKDF2HMACNotBuiltIn(IHash underlyingHash, byte[] password, byte[] salt, uint iterations) { if (password == null) { throw new ArgumentNullException(nameof(password)); } if (salt == null) { throw new ArgumentNullException(nameof(salt)); } if (iterations <= 0) { throw new ArgumentException(IterationTooSmall); } _password = ArrayUtils.Clone(password); _salt = ArrayUtils.Clone(salt); var hash = underlyingHash?.Clone() ?? throw new ArgumentNullException(nameof(underlyingHash)); _hmacNotBuiltIn = HMACNotBuiltIn.CreateHMAC(hash, _password); _iterations = iterations; _blockSize = _hmacNotBuiltIn.HashSize; _buffer = new byte[_blockSize]; Initialize(); }
public static IHMACNotBuiltIn CreateHMAC(IHash hash, byte[] hmacKey) => HMACNotBuiltIn.CreateHMAC(hash, hmacKey);