diff options
-rw-r--r-- | crypto/src/crypto/macs/HMac.cs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/src/crypto/macs/HMac.cs b/crypto/src/crypto/macs/HMac.cs index 460f3c5a0..3d42aec0f 100644 --- a/crypto/src/crypto/macs/HMac.cs +++ b/crypto/src/crypto/macs/HMac.cs @@ -136,11 +136,15 @@ namespace Org.BouncyCastle.Crypto.Macs */ public virtual void Reset() { - // Reset underlying digest - digest.Reset(); - - // Initialise the digest - digest.BlockUpdate(inputPad, 0, inputPad.Length); + if (ipadState != null) + { + ((IMemoable)digest).Reset(ipadState); + } + else + { + digest.Reset(); + digest.BlockUpdate(inputPad, 0, inputPad.Length); + } } private static void XorPad(byte[] pad, int len, byte n) |