MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / SetKey

Method SetKey

extra/yassl/taocrypt/include/hmac.hpp:81–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79// Key generation
80template <class T>
81void HMAC<T>::SetKey(const byte* key, word32 length)
82{
83 Init();
84
85 if (length <= T::BLOCK_SIZE)
86 memcpy(ipad_, key, length);
87 else {
88 mac_.Update(key, length);
89 mac_.Final(ipad_);
90 length = T::DIGEST_SIZE;
91 }
92 memset(ipad_ + length, 0, T::BLOCK_SIZE - length);
93
94 for (word32 i = 0; i < T::BLOCK_SIZE; i++) {
95 opad_[i] = ipad_[i] ^ OPAD;
96 ipad_[i] ^= IPAD;
97 }
98}
99
100
101// Inner Key Hash

Callers 1

DeriveKeyMethod · 0.45

Calls 2

UpdateMethod · 0.45
FinalMethod · 0.45

Tested by

no test coverage detected