/* * Duplicate this engine. The returned instance inherits the * current state (key, data already processed...) but is * thereafter independent. */ public HMAC Dup() { HMAC hm = new HMAC(h.Dup(), false); Array.Copy(key, 0, hm.key, 0, keyLen); hm.keyLen = keyLen; hm.dataLen = dataLen; return(hm); }
/* * Create the instance over the provided hash function * implementation. The digest instance is linked in and will * be used repeatedly. The engine is not seeded yet. */ public HMAC_DRBG(IDigest h) { hm = new HMAC(h.Dup()); int len = h.DigestSize; K = new byte[len]; V = new byte[len]; seeded = false; Reset(); }