📄 shmac.h
字号:
// shmac.h// Scott McPeak's transmogrify of Wei Dai's HMAC, which is itself an// implementation of RFC 2104 HMAC; validation vectors for MD5-HMAC// and SHA-HMAC can be found in RFC 2202// hmac.h - written and placed in the public domain by Wei Dai#ifndef HMAC_H#define HMAC_H#include "cryptlib.h"#include "misc.h"// HMAC(K, text) = H(K XOR opad, H(K XOR ipad, text))class HMAC : public MessageAuthenticationCode{public: // SM: g++ 2.7.2 needs to see KEYLENGTH before it is used enum {KEYLENGTH=16, // SM: we don't need these, and they are problematic // MAX_KEYLENGTH=T::DATASIZE, DIGESTSIZE=T::DIGESTSIZE, DATASIZE=T::DATASIZE }; HMAC(HashModule &hash, const byte *userKey, unsigned int keylength=KEYLENGTH); void Update(const byte *input, unsigned int length); void Final(byte *mac); unsigned int DigestSize() const; unsigned int DataSize() const;private: enum {IPAD=0x36, OPAD=0x5c}; void Init(); SecByteBlock k_ipad, k_opad; HashModule &hash;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -