/// <remarks> /// Create keying material using a two stage generator /// </remarks> private byte[] GetBlock() { // generate seed; 2x input block per NIST sp800-90b byte[] seed = _seedEngine.GetBytes((_hashEngine.BlockSize * 2)); if (_hashEngine.GetType().Equals(typeof(SHA512)) || _hashEngine.GetType().Equals(typeof(SHA256))) { // hmac key size is digest hash size: rfc 2104 byte[] key = _seedEngine.GetBytes(_hashEngine.DigestSize); // set hmac to *not* dispose of underlying digest using (HMAC mac = new HMAC(_hashEngine, key, false)) return(mac.ComputeMac(seed)); } else { // other implemented digests do not require hmac return(_hashEngine.ComputeHash(seed)); } }