summaryrefslogtreecommitdiff
path: root/hmac.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-14 11:41:39 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2006-12-14 11:41:39 +0000
commit085c5b2d0b70a2ff3d9ccf8616a7bdf4abbc957f (patch)
treebe3960f1424e79719ea9c5f6152df003bc1c44f3 /hmac.cpp
parent60b7db799a5d9d607dba4b9a66c4421bb60f2577 (diff)
downloadcryptopp-085c5b2d0b70a2ff3d9ccf8616a7bdf4abbc957f.tar.gz
port to Borland C++Builder 2006
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@260 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'hmac.cpp')
-rw-r--r--hmac.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/hmac.cpp b/hmac.cpp
index dc9fc9b..d4a649c 100644
--- a/hmac.cpp
+++ b/hmac.cpp
@@ -20,6 +20,8 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
if (!blockSize)
throw InvalidArgument("HMAC: can only be used with a block-based hash function");
+ m_buf.resize(2*AccessHash().BlockSize() + AccessHash().DigestSize());
+
if (keylength <= blockSize)
memcpy(AccessIpad(), userKey, keylength);
else
@@ -33,8 +35,8 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
for (unsigned int i=0; i<blockSize; i++)
{
- AccessOpad()[i] = AccessIpad()[i] ^ OPAD;
- AccessIpad()[i] ^= IPAD;
+ AccessOpad()[i] = AccessIpad()[i] ^ 0x5c;
+ AccessIpad()[i] ^= 0x36;
}
}