diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2006-12-14 11:41:39 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2006-12-14 11:41:39 +0000 |
commit | 085c5b2d0b70a2ff3d9ccf8616a7bdf4abbc957f (patch) | |
tree | be3960f1424e79719ea9c5f6152df003bc1c44f3 /hmac.h | |
parent | 60b7db799a5d9d607dba4b9a66c4421bb60f2577 (diff) | |
download | cryptopp-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.h')
-rw-r--r-- | hmac.h | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) //! _ -class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, UINT_MAX>, public MessageAuthenticationCode +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, INT_MAX>, public MessageAuthenticationCode { public: HMAC_Base() : m_innerHashKeyed(false) {} @@ -23,15 +23,14 @@ public: protected: virtual HashTransformation & AccessHash() =0; - virtual byte * AccessIpad() =0; - virtual byte * AccessOpad() =0; - virtual byte * AccessInnerHash() =0; + byte * AccessIpad() {return m_buf;} + byte * AccessOpad() {return m_buf + AccessHash().BlockSize();} + byte * AccessInnerHash() {return m_buf + 2*AccessHash().BlockSize();} private: void KeyInnerHash(); - enum {IPAD=0x36, OPAD=0x5c}; - + SecByteBlock m_buf; bool m_innerHashKeyed; }; @@ -41,7 +40,8 @@ template <class T> class HMAC : public MessageAuthenticationCodeImpl<HMAC_Base, HMAC<T> > { public: - enum {DIGESTSIZE=T::DIGESTSIZE, BLOCKSIZE=T::BLOCKSIZE}; + CRYPTOPP_CONSTANT(DIGESTSIZE=T::DIGESTSIZE) + CRYPTOPP_CONSTANT(BLOCKSIZE=T::BLOCKSIZE) HMAC() {} HMAC(const byte *key, size_t length=HMAC_Base::DEFAULT_KEYLENGTH) @@ -52,12 +52,7 @@ public: private: HashTransformation & AccessHash() {return m_hash;} - byte * AccessIpad() {return m_ipad;} - byte * AccessOpad() {return m_opad;} - byte * AccessInnerHash() {return m_innerHash;} - FixedSizeSecBlock<byte, BLOCKSIZE> m_ipad, m_opad; - FixedSizeSecBlock<byte, DIGESTSIZE> m_innerHash; T m_hash; }; |