/// <summary> /// Initializes a new instance of the <see cref="Hkdf"/> class. /// </summary> /// <param name="keyedHashAlgorithm">The class that will be used to perform key derivation.</param> /// <param name="data">The additional input data.</param> private Hkdf(KeyedHashAlgorithm keyedHashAlgorithm, byte[] data) { if (keyedHashAlgorithm.IsNull()) { throw new ArgumentNullException(paramName: nameof(keyedHashAlgorithm)); } m_data = (data ?? CompatibilityUtils.Array.Empty <byte>()); m_keyedHashAlgorithm = keyedHashAlgorithm; m_maxKeyLength = (byte.MaxValue * (keyedHashAlgorithm.HashSize >> 3)); }
/// <summary> /// Initializes a new instance of the <see cref="Pbkdf2"/> class. /// </summary> /// <param name="keyedHashAlgorithm">The class that will be used to perform key derivation.</param> /// <param name="salt">The salt that will be combined with the passord during key derivation.</param> /// <param name="iterationCount">The number of iterations that will be performed to derive a new key.</param> private Pbkdf2(KeyedHashAlgorithm keyedHashAlgorithm, ReadOnlySpan <byte> salt, uint iterationCount) { if (keyedHashAlgorithm.IsNull()) { throw new ArgumentNullException(paramName: nameof(keyedHashAlgorithm)); } m_iterationCount = iterationCount; m_keyedHashAlgorithm = keyedHashAlgorithm; m_salt = salt.ToArray(); }