diff --git a/AES128_8cpp_source.html b/AES128_8cpp_source.html index 828ed98f..b40c4c5e 100644 --- a/AES128_8cpp_source.html +++ b/AES128_8cpp_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES192_8cpp_source.html b/AES192_8cpp_source.html index 073abea7..1d67b047 100644 --- a/AES192_8cpp_source.html +++ b/AES192_8cpp_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES256_8cpp_source.html b/AES256_8cpp_source.html index 6bf10a6f..b82c5f47 100644 --- a/AES256_8cpp_source.html +++ b/AES256_8cpp_source.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AESCommon_8cpp_source.html b/AESCommon_8cpp_source.html index 666bd4cd..41c8e25f 100644 --- a/AESCommon_8cpp_source.html +++ b/AESCommon_8cpp_source.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES_8h_source.html b/AES_8h_source.html index a58e252c..34a3b15e 100644 --- a/AES_8h_source.html +++ b/AES_8h_source.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2b_8cpp_source.html b/BLAKE2b_8cpp_source.html index ba7bf664..a002f839 100644 --- a/BLAKE2b_8cpp_source.html +++ b/BLAKE2b_8cpp_source.html @@ -224,78 +224,97 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
162  reset();
163 }
164 
-
165 // Permutation on the message input state for BLAKE2b.
-
166 static const uint8_t sigma[12][16] PROGMEM = {
-
167  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
-
168  {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
-
169  {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},
-
170  { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},
-
171  { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},
-
172  { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},
-
173  {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},
-
174  {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},
-
175  { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},
-
176  {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0},
-
177  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
-
178  {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
-
179 };
-
180 
-
181 // Perform a BLAKE2b quarter round operation.
-
182 #define quarterRound(a, b, c, d, i) \
-
183  do { \
-
184  uint64_t _b = (b); \
-
185  uint64_t _a = (a) + _b + state.m[pgm_read_byte(&(sigma[index][2 * (i)]))]; \
-
186  uint64_t _d = rightRotate32_64((d) ^ _a); \
-
187  uint64_t _c = (c) + _d; \
-
188  _b = rightRotate24_64(_b ^ _c); \
-
189  _a += _b + state.m[pgm_read_byte(&(sigma[index][2 * (i) + 1]))]; \
-
190  (d) = _d = rightRotate16_64(_d ^ _a); \
-
191  _c += _d; \
-
192  (a) = _a; \
-
193  (b) = rightRotate63_64(_b ^ _c); \
-
194  (c) = _c; \
-
195  } while (0)
-
196 
-
197 void BLAKE2b::processChunk(uint64_t f0)
-
198 {
-
199  uint8_t index;
-
200 
-
201  // Byte-swap the message buffer into little-endian if necessary.
-
202 #if !defined(CRYPTO_LITTLE_ENDIAN)
-
203  for (index = 0; index < 16; ++index)
-
204  state.m[index] = le64toh(state.m[index]);
-
205 #endif
-
206 
-
207  // Format the block to be hashed.
-
208  memcpy(state.v, state.h, sizeof(state.h));
-
209  state.v[8] = BLAKE2b_IV0;
-
210  state.v[9] = BLAKE2b_IV1;
-
211  state.v[10] = BLAKE2b_IV2;
-
212  state.v[11] = BLAKE2b_IV3;
-
213  state.v[12] = BLAKE2b_IV4 ^ state.lengthLow;
-
214  state.v[13] = BLAKE2b_IV5 ^ state.lengthHigh;
-
215  state.v[14] = BLAKE2b_IV6 ^ f0;
-
216  state.v[15] = BLAKE2b_IV7;
-
217 
-
218  // Perform the 12 BLAKE2b rounds.
-
219  for (index = 0; index < 12; ++index) {
-
220  // Column round.
-
221  quarterRound(state.v[0], state.v[4], state.v[8], state.v[12], 0);
-
222  quarterRound(state.v[1], state.v[5], state.v[9], state.v[13], 1);
-
223  quarterRound(state.v[2], state.v[6], state.v[10], state.v[14], 2);
-
224  quarterRound(state.v[3], state.v[7], state.v[11], state.v[15], 3);
-
225 
-
226  // Diagonal round.
-
227  quarterRound(state.v[0], state.v[5], state.v[10], state.v[15], 4);
-
228  quarterRound(state.v[1], state.v[6], state.v[11], state.v[12], 5);
-
229  quarterRound(state.v[2], state.v[7], state.v[8], state.v[13], 6);
-
230  quarterRound(state.v[3], state.v[4], state.v[9], state.v[14], 7);
-
231  }
-
232 
-
233  // Combine the new and old hash values.
-
234  for (index = 0; index < 8; ++index)
-
235  state.h[index] ^= (state.v[index] ^ state.v[index + 8]);
-
236 }
+
165 void BLAKE2b::resetHMAC(const void *key, size_t keyLen)
+
166 {
+
167  formatHMACKey(state.m, key, keyLen, 0x36);
+
168  state.lengthLow += 128;
+
169  processChunk(0);
+
170 }
+
171 
+
172 void BLAKE2b::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
173 {
+
174  uint8_t temp[64];
+
175  finalize(temp, sizeof(temp));
+
176  formatHMACKey(state.m, key, keyLen, 0x5C);
+
177  state.lengthLow += 128;
+
178  processChunk(0);
+
179  update(temp, sizeof(temp));
+
180  finalize(hash, hashLen);
+
181  clean(temp);
+
182 }
+
183 
+
184 // Permutation on the message input state for BLAKE2b.
+
185 static const uint8_t sigma[12][16] PROGMEM = {
+
186  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+
187  {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
+
188  {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},
+
189  { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},
+
190  { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},
+
191  { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},
+
192  {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},
+
193  {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},
+
194  { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},
+
195  {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0},
+
196  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+
197  {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
+
198 };
+
199 
+
200 // Perform a BLAKE2b quarter round operation.
+
201 #define quarterRound(a, b, c, d, i) \
+
202  do { \
+
203  uint64_t _b = (b); \
+
204  uint64_t _a = (a) + _b + state.m[pgm_read_byte(&(sigma[index][2 * (i)]))]; \
+
205  uint64_t _d = rightRotate32_64((d) ^ _a); \
+
206  uint64_t _c = (c) + _d; \
+
207  _b = rightRotate24_64(_b ^ _c); \
+
208  _a += _b + state.m[pgm_read_byte(&(sigma[index][2 * (i) + 1]))]; \
+
209  (d) = _d = rightRotate16_64(_d ^ _a); \
+
210  _c += _d; \
+
211  (a) = _a; \
+
212  (b) = rightRotate63_64(_b ^ _c); \
+
213  (c) = _c; \
+
214  } while (0)
+
215 
+
216 void BLAKE2b::processChunk(uint64_t f0)
+
217 {
+
218  uint8_t index;
+
219 
+
220  // Byte-swap the message buffer into little-endian if necessary.
+
221 #if !defined(CRYPTO_LITTLE_ENDIAN)
+
222  for (index = 0; index < 16; ++index)
+
223  state.m[index] = le64toh(state.m[index]);
+
224 #endif
+
225 
+
226  // Format the block to be hashed.
+
227  memcpy(state.v, state.h, sizeof(state.h));
+
228  state.v[8] = BLAKE2b_IV0;
+
229  state.v[9] = BLAKE2b_IV1;
+
230  state.v[10] = BLAKE2b_IV2;
+
231  state.v[11] = BLAKE2b_IV3;
+
232  state.v[12] = BLAKE2b_IV4 ^ state.lengthLow;
+
233  state.v[13] = BLAKE2b_IV5 ^ state.lengthHigh;
+
234  state.v[14] = BLAKE2b_IV6 ^ f0;
+
235  state.v[15] = BLAKE2b_IV7;
+
236 
+
237  // Perform the 12 BLAKE2b rounds.
+
238  for (index = 0; index < 12; ++index) {
+
239  // Column round.
+
240  quarterRound(state.v[0], state.v[4], state.v[8], state.v[12], 0);
+
241  quarterRound(state.v[1], state.v[5], state.v[9], state.v[13], 1);
+
242  quarterRound(state.v[2], state.v[6], state.v[10], state.v[14], 2);
+
243  quarterRound(state.v[3], state.v[7], state.v[11], state.v[15], 3);
+
244 
+
245  // Diagonal round.
+
246  quarterRound(state.v[0], state.v[5], state.v[10], state.v[15], 4);
+
247  quarterRound(state.v[1], state.v[6], state.v[11], state.v[12], 5);
+
248  quarterRound(state.v[2], state.v[7], state.v[8], state.v[13], 6);
+
249  quarterRound(state.v[3], state.v[4], state.v[9], state.v[14], 7);
+
250  }
+
251 
+
252  // Combine the new and old hash values.
+
253  for (index = 0; index < 8; ++index)
+
254  state.h[index] ^= (state.v[index] ^ state.v[index + 8]);
+
255 }
BLAKE2b::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: BLAKE2b.cpp:143
BLAKE2b::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: BLAKE2b.cpp:81
BLAKE2b::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: BLAKE2b.cpp:159
@@ -305,10 +324,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BLAKE2b::~BLAKE2b
virtual ~BLAKE2b()
Destroys this BLAKE2b hash object after clearing sensitive information.
Definition: BLAKE2b.cpp:56
BLAKE2b::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: BLAKE2b.cpp:118
Bitmap::data
uint8_t * data()
Returns a pointer to the start of the bitmap's data buffer.
Definition: Bitmap.h:53
+
BLAKE2b::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: BLAKE2b.cpp:165
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
+
BLAKE2b::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: BLAKE2b.cpp:172
diff --git a/BLAKE2b_8h_source.html b/BLAKE2b_8h_source.html index 27596d60..f8757953 100644 --- a/BLAKE2b_8h_source.html +++ b/BLAKE2b_8h_source.html @@ -131,20 +131,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
41 
42  void clear();
43 
-
44 private:
-
45  struct {
-
46  uint64_t h[8];
-
47  uint64_t m[16];
-
48  uint64_t v[16];
-
49  uint64_t lengthLow;
-
50  uint64_t lengthHigh;
-
51  uint8_t chunkSize;
-
52  } state;
-
53 
-
54  void processChunk(uint64_t f0);
-
55 };
+
44  void resetHMAC(const void *key, size_t keyLen);
+
45  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
46 
+
47 private:
+
48  struct {
+
49  uint64_t h[8];
+
50  uint64_t m[16];
+
51  uint64_t v[16];
+
52  uint64_t lengthLow;
+
53  uint64_t lengthHigh;
+
54  uint8_t chunkSize;
+
55  } state;
56 
-
57 #endif
+
57  void processChunk(uint64_t f0);
+
58 };
+
59 
+
60 #endif
BLAKE2b::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: BLAKE2b.cpp:143
BLAKE2b::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: BLAKE2b.cpp:81
BLAKE2b::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: BLAKE2b.cpp:159
@@ -155,10 +158,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BLAKE2b::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: BLAKE2b.cpp:61
BLAKE2b::~BLAKE2b
virtual ~BLAKE2b()
Destroys this BLAKE2b hash object after clearing sensitive information.
Definition: BLAKE2b.cpp:56
BLAKE2b::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: BLAKE2b.cpp:118
+
BLAKE2b::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: BLAKE2b.cpp:165
+
BLAKE2b::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: BLAKE2b.cpp:172
diff --git a/BLAKE2s_8cpp_source.html b/BLAKE2s_8cpp_source.html index 7c42b8ef..66a14990 100644 --- a/BLAKE2s_8cpp_source.html +++ b/BLAKE2s_8cpp_source.html @@ -219,88 +219,110 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
157  reset();
158 }
159 
-
160 // Permutation on the message input state for BLAKE2s.
-
161 static const uint8_t sigma[10][16] PROGMEM = {
-
162  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
-
163  {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
-
164  {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},
-
165  { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},
-
166  { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},
-
167  { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},
-
168  {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},
-
169  {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},
-
170  { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},
-
171  {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0}
-
172 };
-
173 
-
174 // Perform a BLAKE2s quarter round operation.
-
175 #define quarterRound(a, b, c, d, i) \
-
176  do { \
-
177  uint32_t _b = (b); \
-
178  uint32_t _a = (a) + _b + state.m[pgm_read_byte(&(sigma[index][2 * (i)]))]; \
-
179  uint32_t _d = rightRotate16((d) ^ _a); \
-
180  uint32_t _c = (c) + _d; \
-
181  _b = rightRotate12(_b ^ _c); \
-
182  _a += _b + state.m[pgm_read_byte(&(sigma[index][2 * (i) + 1]))]; \
-
183  (d) = _d = rightRotate8(_d ^ _a); \
-
184  _c += _d; \
-
185  (a) = _a; \
-
186  (b) = rightRotate7(_b ^ _c); \
-
187  (c) = _c; \
-
188  } while (0)
-
189 
-
190 void BLAKE2s::processChunk(uint32_t f0)
-
191 {
-
192  uint8_t index;
-
193 
-
194  // Byte-swap the message buffer into little-endian if necessary.
-
195 #if !defined(CRYPTO_LITTLE_ENDIAN)
-
196  for (index = 0; index < 16; ++index)
-
197  state.m[index] = le32toh(state.m[index]);
-
198 #endif
-
199 
-
200  // Format the block to be hashed.
-
201  memcpy(state.v, state.h, sizeof(state.h));
-
202  state.v[8] = BLAKE2s_IV0;
-
203  state.v[9] = BLAKE2s_IV1;
-
204  state.v[10] = BLAKE2s_IV2;
-
205  state.v[11] = BLAKE2s_IV3;
-
206  state.v[12] = BLAKE2s_IV4 ^ (uint32_t)(state.length);
-
207  state.v[13] = BLAKE2s_IV5 ^ (uint32_t)(state.length >> 32);
-
208  state.v[14] = BLAKE2s_IV6 ^ f0;
-
209  state.v[15] = BLAKE2s_IV7;
-
210 
-
211  // Perform the 10 BLAKE2s rounds.
-
212  for (index = 0; index < 10; ++index) {
-
213  // Column round.
-
214  quarterRound(state.v[0], state.v[4], state.v[8], state.v[12], 0);
-
215  quarterRound(state.v[1], state.v[5], state.v[9], state.v[13], 1);
-
216  quarterRound(state.v[2], state.v[6], state.v[10], state.v[14], 2);
-
217  quarterRound(state.v[3], state.v[7], state.v[11], state.v[15], 3);
-
218 
-
219  // Diagonal round.
-
220  quarterRound(state.v[0], state.v[5], state.v[10], state.v[15], 4);
-
221  quarterRound(state.v[1], state.v[6], state.v[11], state.v[12], 5);
-
222  quarterRound(state.v[2], state.v[7], state.v[8], state.v[13], 6);
-
223  quarterRound(state.v[3], state.v[4], state.v[9], state.v[14], 7);
-
224  }
-
225 
-
226  // Combine the new and old hash values.
-
227  for (index = 0; index < 8; ++index)
-
228  state.h[index] ^= (state.v[index] ^ state.v[index + 8]);
-
229 }
+
160 void BLAKE2s::resetHMAC(const void *key, size_t keyLen)
+
161 {
+
162  formatHMACKey(state.m, key, keyLen, 0x36);
+
163  state.length += 64;
+
164  processChunk(0);
+
165 }
+
166 
+
167 void BLAKE2s::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
168 {
+
169  uint8_t temp[32];
+
170  finalize(temp, sizeof(temp));
+
171  formatHMACKey(state.m, key, keyLen, 0x5C);
+
172  state.length += 64;
+
173  processChunk(0);
+
174  update(temp, sizeof(temp));
+
175  finalize(hash, hashLen);
+
176  clean(temp);
+
177 }
+
178 
+
179 // Permutation on the message input state for BLAKE2s.
+
180 static const uint8_t sigma[10][16] PROGMEM = {
+
181  { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+
182  {14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
+
183  {11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},
+
184  { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},
+
185  { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},
+
186  { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},
+
187  {12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},
+
188  {13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},
+
189  { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},
+
190  {10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0}
+
191 };
+
192 
+
193 // Perform a BLAKE2s quarter round operation.
+
194 #define quarterRound(a, b, c, d, i) \
+
195  do { \
+
196  uint32_t _b = (b); \
+
197  uint32_t _a = (a) + _b + state.m[pgm_read_byte(&(sigma[index][2 * (i)]))]; \
+
198  uint32_t _d = rightRotate16((d) ^ _a); \
+
199  uint32_t _c = (c) + _d; \
+
200  _b = rightRotate12(_b ^ _c); \
+
201  _a += _b + state.m[pgm_read_byte(&(sigma[index][2 * (i) + 1]))]; \
+
202  (d) = _d = rightRotate8(_d ^ _a); \
+
203  _c += _d; \
+
204  (a) = _a; \
+
205  (b) = rightRotate7(_b ^ _c); \
+
206  (c) = _c; \
+
207  } while (0)
+
208 
+
209 void BLAKE2s::processChunk(uint32_t f0)
+
210 {
+
211  uint8_t index;
+
212 
+
213  // Byte-swap the message buffer into little-endian if necessary.
+
214 #if !defined(CRYPTO_LITTLE_ENDIAN)
+
215  for (index = 0; index < 16; ++index)
+
216  state.m[index] = le32toh(state.m[index]);
+
217 #endif
+
218 
+
219  // Format the block to be hashed.
+
220  memcpy(state.v, state.h, sizeof(state.h));
+
221  state.v[8] = BLAKE2s_IV0;
+
222  state.v[9] = BLAKE2s_IV1;
+
223  state.v[10] = BLAKE2s_IV2;
+
224  state.v[11] = BLAKE2s_IV3;
+
225  state.v[12] = BLAKE2s_IV4 ^ (uint32_t)(state.length);
+
226  state.v[13] = BLAKE2s_IV5 ^ (uint32_t)(state.length >> 32);
+
227  state.v[14] = BLAKE2s_IV6 ^ f0;
+
228  state.v[15] = BLAKE2s_IV7;
+
229 
+
230  // Perform the 10 BLAKE2s rounds.
+
231  for (index = 0; index < 10; ++index) {
+
232  // Column round.
+
233  quarterRound(state.v[0], state.v[4], state.v[8], state.v[12], 0);
+
234  quarterRound(state.v[1], state.v[5], state.v[9], state.v[13], 1);
+
235  quarterRound(state.v[2], state.v[6], state.v[10], state.v[14], 2);
+
236  quarterRound(state.v[3], state.v[7], state.v[11], state.v[15], 3);
+
237 
+
238  // Diagonal round.
+
239  quarterRound(state.v[0], state.v[5], state.v[10], state.v[15], 4);
+
240  quarterRound(state.v[1], state.v[6], state.v[11], state.v[12], 5);
+
241  quarterRound(state.v[2], state.v[7], state.v[8], state.v[13], 6);
+
242  quarterRound(state.v[3], state.v[4], state.v[9], state.v[14], 7);
+
243  }
+
244 
+
245  // Combine the new and old hash values.
+
246  for (index = 0; index < 8; ++index)
+
247  state.h[index] ^= (state.v[index] ^ state.v[index + 8]);
+
248 }
BLAKE2s::~BLAKE2s
virtual ~BLAKE2s()
Destroys this BLAKE2s hash object after clearing sensitive information.
Definition: BLAKE2s.cpp:56
BLAKE2s::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: BLAKE2s.cpp:61
BLAKE2s::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: BLAKE2s.cpp:154
BLAKE2s::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: BLAKE2s.cpp:81
BLAKE2s::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: BLAKE2s.cpp:66
BLAKE2s::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: BLAKE2s.cpp:116
+
BLAKE2s::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: BLAKE2s.cpp:160
BLAKE2s::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: BLAKE2s.cpp:138
+
BLAKE2s::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: BLAKE2s.cpp:167
BLAKE2s::BLAKE2s
BLAKE2s()
Constructs a BLAKE2s hash object.
Definition: BLAKE2s.cpp:47
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
diff --git a/BLAKE2s_8h_source.html b/BLAKE2s_8h_source.html index 969a376f..7c131cd5 100644 --- a/BLAKE2s_8h_source.html +++ b/BLAKE2s_8h_source.html @@ -131,19 +131,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
41 
42  void clear();
43 
-
44 private:
-
45  struct {
-
46  uint32_t h[8];
-
47  uint32_t m[16];
-
48  uint32_t v[16];
-
49  uint64_t length;
-
50  uint8_t chunkSize;
-
51  } state;
-
52 
-
53  void processChunk(uint32_t f0);
-
54 };
+
44  void resetHMAC(const void *key, size_t keyLen);
+
45  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
46 
+
47 private:
+
48  struct {
+
49  uint32_t h[8];
+
50  uint32_t m[16];
+
51  uint32_t v[16];
+
52  uint64_t length;
+
53  uint8_t chunkSize;
+
54  } state;
55 
-
56 #endif
+
56  void processChunk(uint32_t f0);
+
57 };
+
58 
+
59 #endif
BLAKE2s::~BLAKE2s
virtual ~BLAKE2s()
Destroys this BLAKE2s hash object after clearing sensitive information.
Definition: BLAKE2s.cpp:56
BLAKE2s::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: BLAKE2s.cpp:61
BLAKE2s::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: BLAKE2s.cpp:154
@@ -152,12 +155,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Hash
Abstract base class for cryptographic hash algorithms.
Definition: Hash.h:29
BLAKE2s::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: BLAKE2s.cpp:116
BLAKE2s
BLAKE2s hash algorithm.
Definition: BLAKE2s.h:28
+
BLAKE2s::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: BLAKE2s.cpp:160
BLAKE2s::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: BLAKE2s.cpp:138
+
BLAKE2s::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: BLAKE2s.cpp:167
BLAKE2s::BLAKE2s
BLAKE2s()
Constructs a BLAKE2s hash object.
Definition: BLAKE2s.cpp:47
diff --git a/Bitmap_8cpp_source.html b/Bitmap_8cpp_source.html index 95420349..30d62c7d 100644 --- a/Bitmap_8cpp_source.html +++ b/Bitmap_8cpp_source.html @@ -694,7 +694,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Bitmap_8h_source.html b/Bitmap_8h_source.html index 5e0a5ea6..214fd12f 100644 --- a/Bitmap_8h_source.html +++ b/Bitmap_8h_source.html @@ -271,7 +271,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlinkLED_8cpp_source.html b/BlinkLED_8cpp_source.html index 60101433..092265fd 100644 --- a/BlinkLED_8cpp_source.html +++ b/BlinkLED_8cpp_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlinkLED_8h_source.html b/BlinkLED_8h_source.html index 9cdd4975..84b807b7 100644 --- a/BlinkLED_8h_source.html +++ b/BlinkLED_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlockCipher_8cpp_source.html b/BlockCipher_8cpp_source.html index 5233dbac..8b9164a7 100644 --- a/BlockCipher_8cpp_source.html +++ b/BlockCipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlockCipher_8h_source.html b/BlockCipher_8h_source.html index c24614b0..54c95c90 100644 --- a/BlockCipher_8h_source.html +++ b/BlockCipher_8h_source.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BoolField_8cpp_source.html b/BoolField_8cpp_source.html index a608ca5e..48007965 100644 --- a/BoolField_8cpp_source.html +++ b/BoolField_8cpp_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BoolField_8h_source.html b/BoolField_8h_source.html index 11589674..f6376c0f 100644 --- a/BoolField_8h_source.html +++ b/BoolField_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CBC_8cpp_source.html b/CBC_8cpp_source.html index 25835312..b65d31ed 100644 --- a/CBC_8cpp_source.html +++ b/CBC_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CBC_8h_source.html b/CBC_8h_source.html index 80b63bad..76c93956 100644 --- a/CBC_8h_source.html +++ b/CBC_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CFB_8cpp_source.html b/CFB_8cpp_source.html index f1594d61..259d2486 100644 --- a/CFB_8cpp_source.html +++ b/CFB_8cpp_source.html @@ -233,7 +233,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CFB_8h_source.html b/CFB_8h_source.html index c03cdf59..8d5f3f9f 100644 --- a/CFB_8h_source.html +++ b/CFB_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CTR_8cpp_source.html b/CTR_8cpp_source.html index 1a1ad9ae..6d751c43 100644 --- a/CTR_8cpp_source.html +++ b/CTR_8cpp_source.html @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CTR_8h_source.html b/CTR_8h_source.html index f78dba4e..12d725c6 100644 --- a/CTR_8h_source.html +++ b/CTR_8h_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaCha_8cpp_source.html b/ChaCha_8cpp_source.html index 9253ccde..66139875 100644 --- a/ChaCha_8cpp_source.html +++ b/ChaCha_8cpp_source.html @@ -300,7 +300,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaCha_8h_source.html b/ChaCha_8h_source.html index 68dd98d9..52f26d8c 100644 --- a/ChaCha_8h_source.html +++ b/ChaCha_8h_source.html @@ -163,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Charlieplex_8cpp_source.html b/Charlieplex_8cpp_source.html index dcdb2810..adedb1f8 100644 --- a/Charlieplex_8cpp_source.html +++ b/Charlieplex_8cpp_source.html @@ -232,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Charlieplex_8h_source.html b/Charlieplex_8h_source.html index 5a22cbce..650e14b3 100644 --- a/Charlieplex_8h_source.html +++ b/Charlieplex_8h_source.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaseLEDs_8cpp_source.html b/ChaseLEDs_8cpp_source.html index 16366eb0..2c5ffde4 100644 --- a/ChaseLEDs_8cpp_source.html +++ b/ChaseLEDs_8cpp_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaseLEDs_8h_source.html b/ChaseLEDs_8h_source.html index 4a1e4d2d..53ee54fe 100644 --- a/ChaseLEDs_8h_source.html +++ b/ChaseLEDs_8h_source.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Cipher_8cpp_source.html b/Cipher_8cpp_source.html index 90a0aacd..4cd65b8c 100644 --- a/Cipher_8cpp_source.html +++ b/Cipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Cipher_8h_source.html b/Cipher_8h_source.html index 64e5858e..69ccc2ec 100644 --- a/Cipher_8h_source.html +++ b/Cipher_8h_source.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Crypto_8cpp_source.html b/Crypto_8cpp_source.html index 2ea64301..89f42efa 100644 --- a/Crypto_8cpp_source.html +++ b/Crypto_8cpp_source.html @@ -127,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Crypto_8h_source.html b/Crypto_8h_source.html index 7f40f85d..ae554b04 100644 --- a/Crypto_8h_source.html +++ b/Crypto_8h_source.html @@ -128,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Curve25519_8cpp_source.html b/Curve25519_8cpp_source.html index c53a53dd..8100e7b6 100644 --- a/Curve25519_8cpp_source.html +++ b/Curve25519_8cpp_source.html @@ -710,14 +710,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
829  }
830 #endif
831 }
-
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:277
+
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:297
Curve25519::eval
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:68
Curve25519::dh1
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:231
Curve25519::dh2
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:269
diff --git a/Curve25519_8h_source.html b/Curve25519_8h_source.html index c4bcedb6..024c853d 100644 --- a/Curve25519_8h_source.html +++ b/Curve25519_8h_source.html @@ -188,7 +188,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DMD_8cpp_source.html b/DMD_8cpp_source.html index e16b128c..0a6b4f82 100644 --- a/DMD_8cpp_source.html +++ b/DMD_8cpp_source.html @@ -456,7 +456,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DMD_8h_source.html b/DMD_8h_source.html index 17167213..9a2d7c88 100644 --- a/DMD_8h_source.html +++ b/DMD_8h_source.html @@ -170,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS1307RTC_8cpp_source.html b/DS1307RTC_8cpp_source.html index 164c84bf..76ad9b35 100644 --- a/DS1307RTC_8cpp_source.html +++ b/DS1307RTC_8cpp_source.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS1307RTC_8h_source.html b/DS1307RTC_8h_source.html index 4b9fc498..2ef0059d 100644 --- a/DS1307RTC_8h_source.html +++ b/DS1307RTC_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3232RTC_8cpp_source.html b/DS3232RTC_8cpp_source.html index 66ce0a1e..840f94f1 100644 --- a/DS3232RTC_8cpp_source.html +++ b/DS3232RTC_8cpp_source.html @@ -575,7 +575,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3232RTC_8h_source.html b/DS3232RTC_8h_source.html index 6f82f896..f17f649d 100644 --- a/DS3232RTC_8h_source.html +++ b/DS3232RTC_8h_source.html @@ -190,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSans9_8h_source.html b/DejaVuSans9_8h_source.html index c48dcacd..8da44530 100644 --- a/DejaVuSans9_8h_source.html +++ b/DejaVuSans9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSansBold9_8h_source.html b/DejaVuSansBold9_8h_source.html index e56b0074..21249d26 100644 --- a/DejaVuSansBold9_8h_source.html +++ b/DejaVuSansBold9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSansItalic9_8h_source.html b/DejaVuSansItalic9_8h_source.html index a0a74483..c143f3f7 100644 --- a/DejaVuSansItalic9_8h_source.html +++ b/DejaVuSansItalic9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EEPROM24_8cpp_source.html b/EEPROM24_8cpp_source.html index 591ee0ac..fd939cd4 100644 --- a/EEPROM24_8cpp_source.html +++ b/EEPROM24_8cpp_source.html @@ -282,7 +282,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EEPROM24_8h_source.html b/EEPROM24_8h_source.html index bb62e351..acd39e77 100644 --- a/EEPROM24_8h_source.html +++ b/EEPROM24_8h_source.html @@ -186,7 +186,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Field_8cpp_source.html b/Field_8cpp_source.html index f4dbee7e..d0479771 100644 --- a/Field_8cpp_source.html +++ b/Field_8cpp_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Field_8h_source.html b/Field_8h_source.html index ec2f81a6..e16017cf 100644 --- a/Field_8h_source.html +++ b/Field_8h_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Form_8cpp_source.html b/Form_8cpp_source.html index cdd45397..7d543dad 100644 --- a/Form_8cpp_source.html +++ b/Form_8cpp_source.html @@ -278,7 +278,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Form_8h_source.html b/Form_8h_source.html index 30b60d6d..727c0808 100644 --- a/Form_8h_source.html +++ b/Form_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Hash_8cpp_source.html b/Hash_8cpp_source.html index c24661e4..2e511d75 100644 --- a/Hash_8cpp_source.html +++ b/Hash_8cpp_source.html @@ -111,21 +111,47 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
21  */
22 
23 #include "Hash.h"
-
24 
-
35 Hash::Hash()
-
36 {
-
37 }
-
38 
-
47 Hash::~Hash()
-
48 {
-
49 }
-
50 
-
Hash::Hash
Hash()
Constructs a new hash object.
Definition: Hash.cpp:35
-
Hash::~Hash
virtual ~Hash()
Destroys this hash object.
Definition: Hash.cpp:47
+
24 #include <string.h>
+
25 
+
36 Hash::Hash()
+
37 {
+
38 }
+
39 
+
48 Hash::~Hash()
+
49 {
+
50 }
+
51 
+
162 void Hash::formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
+
163 {
+
164  size_t size = blockSize();
+
165  reset();
+
166  if (len <= size) {
+
167  memcpy(block, key, len);
+
168  } else {
+
169  update(key, len);
+
170  len = hashSize();
+
171  finalize(block, len);
+
172  reset();
+
173  }
+
174  memset(block + len, pad, size - len);
+
175  uint8_t *b = (uint8_t *)block;
+
176  while (len > 0) {
+
177  *b++ ^= pad;
+
178  --len;
+
179  }
+
180 }
+
Hash::blockSize
virtual size_t blockSize() const =0
Size of the internal block used by the hash algorithm.
+
Hash::Hash
Hash()
Constructs a new hash object.
Definition: Hash.cpp:36
+
Hash::reset
virtual void reset()=0
Resets the hash ready for a new hashing process.
+
Hash::hashSize
virtual size_t hashSize() const =0
Size of the hash result from finalize().
+
Hash::~Hash
virtual ~Hash()
Destroys this hash object.
Definition: Hash.cpp:48
+
Hash::update
virtual void update(const void *data, size_t len)=0
Updates the hash with more data.
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
+
Hash::finalize
virtual void finalize(void *hash, size_t len)=0
Finalizes the hashing process and returns the hash.
diff --git a/Hash_8h_source.html b/Hash_8h_source.html index 754247e7..80500dae 100644 --- a/Hash_8h_source.html +++ b/Hash_8h_source.html @@ -130,22 +130,31 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
40  virtual void finalize(void *hash, size_t len) = 0;
41 
42  virtual void clear() = 0;
-
43 };
-
44 
-
45 #endif
+
43 
+
44  virtual void resetHMAC(const void *key, size_t keyLen) = 0;
+
45  virtual void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen) = 0;
+
46 
+
47 protected:
+
48  void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad);
+
49 };
+
50 
+
51 #endif
Hash::blockSize
virtual size_t blockSize() const =0
Size of the internal block used by the hash algorithm.
Hash::clear
virtual void clear()=0
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
-
Hash::Hash
Hash()
Constructs a new hash object.
Definition: Hash.cpp:35
+
Hash::Hash
Hash()
Constructs a new hash object.
Definition: Hash.cpp:36
Hash
Abstract base class for cryptographic hash algorithms.
Definition: Hash.h:29
+
Hash::finalizeHMAC
virtual void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)=0
Finalizes the HMAC hashing process and returns the hash.
Hash::reset
virtual void reset()=0
Resets the hash ready for a new hashing process.
+
Hash::resetHMAC
virtual void resetHMAC(const void *key, size_t keyLen)=0
Resets the hash ready for a new HMAC hashing process.
Hash::hashSize
virtual size_t hashSize() const =0
Size of the hash result from finalize().
-
Hash::~Hash
virtual ~Hash()
Destroys this hash object.
Definition: Hash.cpp:47
+
Hash::~Hash
virtual ~Hash()
Destroys this hash object.
Definition: Hash.cpp:48
Hash::update
virtual void update(const void *data, size_t len)=0
Updates the hash with more data.
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
Hash::finalize
virtual void finalize(void *hash, size_t len)=0
Finalizes the hashing process and returns the hash.
diff --git a/I2CMaster_8cpp_source.html b/I2CMaster_8cpp_source.html index 770d0901..f8c14d09 100644 --- a/I2CMaster_8cpp_source.html +++ b/I2CMaster_8cpp_source.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/I2CMaster_8h_source.html b/I2CMaster_8h_source.html index b4b5d502..637f9c55 100644 --- a/I2CMaster_8h_source.html +++ b/I2CMaster_8h_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IRreceiver_8cpp_source.html b/IRreceiver_8cpp_source.html index 47b61afb..d5b80d4c 100644 --- a/IRreceiver_8cpp_source.html +++ b/IRreceiver_8cpp_source.html @@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IRreceiver_8h_source.html b/IRreceiver_8h_source.html index 3bb9a0d9..2733b4b4 100644 --- a/IRreceiver_8h_source.html +++ b/IRreceiver_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IntField_8cpp_source.html b/IntField_8cpp_source.html index 2f0d6392..b7141d68 100644 --- a/IntField_8cpp_source.html +++ b/IntField_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IntField_8h_source.html b/IntField_8h_source.html index 625ac57e..e01d0e1b 100644 --- a/IntField_8h_source.html +++ b/IntField_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/KeccakCore_8cpp_source.html b/KeccakCore_8cpp_source.html index e697d1c8..8eed7d20 100644 --- a/KeccakCore_8cpp_source.html +++ b/KeccakCore_8cpp_source.html @@ -246,82 +246,106 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
247  clean(state);
248 }
249 
-
253 void KeccakCore::keccakp()
-
254 {
-
255  static const uint8_t addMod5Table[9] PROGMEM = {
-
256  0, 1, 2, 3, 4, 0, 1, 2, 3
-
257  };
-
258  #define addMod5(x, y) (pgm_read_byte(&(addMod5Table[(x) + (y)])))
-
259  uint64_t D;
-
260  uint8_t index, index2;
-
261  for (uint8_t round = 0; round < 24; ++round) {
-
262  // Step mapping theta. The specification mentions two temporary
-
263  // arrays of size 5 called C and D. To save a bit of memory,
-
264  // we use the first row of B to store C and compute D on the fly.
-
265  for (index = 0; index < 5; ++index) {
-
266  state.B[0][index] = state.A[0][index] ^ state.A[1][index] ^
-
267  state.A[2][index] ^ state.A[3][index] ^
-
268  state.A[4][index];
-
269  }
-
270  for (index = 0; index < 5; ++index) {
-
271  D = state.B[0][addMod5(index, 4)] ^
-
272  leftRotate1_64(state.B[0][addMod5(index, 1)]);
-
273  for (index2 = 0; index2 < 5; ++index2)
-
274  state.A[index2][index] ^= D;
-
275  }
-
276 
-
277  // Step mapping rho and pi combined into a single step.
-
278  // Rotate all lanes by a specific offset and rearrange.
-
279  state.B[0][0] = state.A[0][0];
-
280  state.B[1][0] = leftRotate28_64(state.A[0][3]);
-
281  state.B[2][0] = leftRotate1_64 (state.A[0][1]);
-
282  state.B[3][0] = leftRotate27_64(state.A[0][4]);
-
283  state.B[4][0] = leftRotate62_64(state.A[0][2]);
-
284  state.B[0][1] = leftRotate44_64(state.A[1][1]);
-
285  state.B[1][1] = leftRotate20_64(state.A[1][4]);
-
286  state.B[2][1] = leftRotate6_64 (state.A[1][2]);
-
287  state.B[3][1] = leftRotate36_64(state.A[1][0]);
-
288  state.B[4][1] = leftRotate55_64(state.A[1][3]);
-
289  state.B[0][2] = leftRotate43_64(state.A[2][2]);
-
290  state.B[1][2] = leftRotate3_64 (state.A[2][0]);
-
291  state.B[2][2] = leftRotate25_64(state.A[2][3]);
-
292  state.B[3][2] = leftRotate10_64(state.A[2][1]);
-
293  state.B[4][2] = leftRotate39_64(state.A[2][4]);
-
294  state.B[0][3] = leftRotate21_64(state.A[3][3]);
-
295  state.B[1][3] = leftRotate45_64(state.A[3][1]);
-
296  state.B[2][3] = leftRotate8_64 (state.A[3][4]);
-
297  state.B[3][3] = leftRotate15_64(state.A[3][2]);
-
298  state.B[4][3] = leftRotate41_64(state.A[3][0]);
-
299  state.B[0][4] = leftRotate14_64(state.A[4][4]);
-
300  state.B[1][4] = leftRotate61_64(state.A[4][2]);
-
301  state.B[2][4] = leftRotate18_64(state.A[4][0]);
-
302  state.B[3][4] = leftRotate56_64(state.A[4][3]);
-
303  state.B[4][4] = leftRotate2_64 (state.A[4][1]);
-
304 
-
305  // Step mapping chi. Combine each lane with two other lanes in its row.
-
306  for (index = 0; index < 5; ++index) {
-
307  for (index2 = 0; index2 < 5; ++index2) {
-
308  state.A[index2][index] =
-
309  state.B[index2][index] ^
-
310  ((~state.B[index2][addMod5(index, 1)]) &
-
311  state.B[index2][addMod5(index, 2)]);
-
312  }
-
313  }
-
314 
-
315  // Step mapping iota. XOR A[0][0] with the round constant.
-
316  static uint64_t const RC[24] PROGMEM = {
-
317  0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808AULL,
-
318  0x8000000080008000ULL, 0x000000000000808BULL, 0x0000000080000001ULL,
-
319  0x8000000080008081ULL, 0x8000000000008009ULL, 0x000000000000008AULL,
-
320  0x0000000000000088ULL, 0x0000000080008009ULL, 0x000000008000000AULL,
-
321  0x000000008000808BULL, 0x800000000000008BULL, 0x8000000000008089ULL,
-
322  0x8000000000008003ULL, 0x8000000000008002ULL, 0x8000000000000080ULL,
-
323  0x000000000000800AULL, 0x800000008000000AULL, 0x8000000080008081ULL,
-
324  0x8000000000008080ULL, 0x0000000080000001ULL, 0x8000000080008008ULL
-
325  };
-
326  state.A[0][0] ^= pgm_read_qword(RC + round);
-
327  }
-
328 }
+
263 void KeccakCore::setHMACKey(const void *key, size_t len, uint8_t pad, size_t hashSize)
+
264 {
+
265  uint8_t *b = (uint8_t *)state.B;
+
266  size_t size = blockSize();
+
267  reset();
+
268  if (len <= size) {
+
269  memcpy(b, key, len);
+
270  } else {
+
271  update(key, len);
+
272  this->pad(0x06);
+
273  extract(b, hashSize);
+
274  len = hashSize;
+
275  reset();
+
276  }
+
277  memset(b + len, pad, size - len);
+
278  while (len > 0) {
+
279  *b++ ^= pad;
+
280  --len;
+
281  }
+
282  update(state.B, size);
+
283 }
+
284 
+
288 void KeccakCore::keccakp()
+
289 {
+
290  static const uint8_t addMod5Table[9] PROGMEM = {
+
291  0, 1, 2, 3, 4, 0, 1, 2, 3
+
292  };
+
293  #define addMod5(x, y) (pgm_read_byte(&(addMod5Table[(x) + (y)])))
+
294  uint64_t D;
+
295  uint8_t index, index2;
+
296  for (uint8_t round = 0; round < 24; ++round) {
+
297  // Step mapping theta. The specification mentions two temporary
+
298  // arrays of size 5 called C and D. To save a bit of memory,
+
299  // we use the first row of B to store C and compute D on the fly.
+
300  for (index = 0; index < 5; ++index) {
+
301  state.B[0][index] = state.A[0][index] ^ state.A[1][index] ^
+
302  state.A[2][index] ^ state.A[3][index] ^
+
303  state.A[4][index];
+
304  }
+
305  for (index = 0; index < 5; ++index) {
+
306  D = state.B[0][addMod5(index, 4)] ^
+
307  leftRotate1_64(state.B[0][addMod5(index, 1)]);
+
308  for (index2 = 0; index2 < 5; ++index2)
+
309  state.A[index2][index] ^= D;
+
310  }
+
311 
+
312  // Step mapping rho and pi combined into a single step.
+
313  // Rotate all lanes by a specific offset and rearrange.
+
314  state.B[0][0] = state.A[0][0];
+
315  state.B[1][0] = leftRotate28_64(state.A[0][3]);
+
316  state.B[2][0] = leftRotate1_64 (state.A[0][1]);
+
317  state.B[3][0] = leftRotate27_64(state.A[0][4]);
+
318  state.B[4][0] = leftRotate62_64(state.A[0][2]);
+
319  state.B[0][1] = leftRotate44_64(state.A[1][1]);
+
320  state.B[1][1] = leftRotate20_64(state.A[1][4]);
+
321  state.B[2][1] = leftRotate6_64 (state.A[1][2]);
+
322  state.B[3][1] = leftRotate36_64(state.A[1][0]);
+
323  state.B[4][1] = leftRotate55_64(state.A[1][3]);
+
324  state.B[0][2] = leftRotate43_64(state.A[2][2]);
+
325  state.B[1][2] = leftRotate3_64 (state.A[2][0]);
+
326  state.B[2][2] = leftRotate25_64(state.A[2][3]);
+
327  state.B[3][2] = leftRotate10_64(state.A[2][1]);
+
328  state.B[4][2] = leftRotate39_64(state.A[2][4]);
+
329  state.B[0][3] = leftRotate21_64(state.A[3][3]);
+
330  state.B[1][3] = leftRotate45_64(state.A[3][1]);
+
331  state.B[2][3] = leftRotate8_64 (state.A[3][4]);
+
332  state.B[3][3] = leftRotate15_64(state.A[3][2]);
+
333  state.B[4][3] = leftRotate41_64(state.A[3][0]);
+
334  state.B[0][4] = leftRotate14_64(state.A[4][4]);
+
335  state.B[1][4] = leftRotate61_64(state.A[4][2]);
+
336  state.B[2][4] = leftRotate18_64(state.A[4][0]);
+
337  state.B[3][4] = leftRotate56_64(state.A[4][3]);
+
338  state.B[4][4] = leftRotate2_64 (state.A[4][1]);
+
339 
+
340  // Step mapping chi. Combine each lane with two other lanes in its row.
+
341  for (index = 0; index < 5; ++index) {
+
342  for (index2 = 0; index2 < 5; ++index2) {
+
343  state.A[index2][index] =
+
344  state.B[index2][index] ^
+
345  ((~state.B[index2][addMod5(index, 1)]) &
+
346  state.B[index2][addMod5(index, 2)]);
+
347  }
+
348  }
+
349 
+
350  // Step mapping iota. XOR A[0][0] with the round constant.
+
351  static uint64_t const RC[24] PROGMEM = {
+
352  0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808AULL,
+
353  0x8000000080008000ULL, 0x000000000000808BULL, 0x0000000080000001ULL,
+
354  0x8000000080008081ULL, 0x8000000000008009ULL, 0x000000000000008AULL,
+
355  0x0000000000000088ULL, 0x0000000080008009ULL, 0x000000008000000AULL,
+
356  0x000000008000808BULL, 0x800000000000008BULL, 0x8000000000008089ULL,
+
357  0x8000000000008003ULL, 0x8000000000008002ULL, 0x8000000000000080ULL,
+
358  0x000000000000800AULL, 0x800000008000000AULL, 0x8000000080008081ULL,
+
359  0x8000000000008080ULL, 0x0000000080000001ULL, 0x8000000080008008ULL
+
360  };
+
361  state.A[0][0] ^= pgm_read_qword(RC + round);
+
362  }
+
363 }
+
KeccakCore::blockSize
size_t blockSize() const
Returns the input block size for the sponge function in bytes.
Definition: KeccakCore.h:38
+
KeccakCore::setHMACKey
void setHMACKey(const void *key, size_t len, uint8_t pad, size_t hashSize)
Sets a HMAC key for a Keccak-based hash algorithm.
Definition: KeccakCore.cpp:263
KeccakCore::setCapacity
void setCapacity(size_t capacity)
Sets the capacity of the Keccak sponge function in bits.
Definition: KeccakCore.cpp:89
KeccakCore::~KeccakCore
~KeccakCore()
Destroys this Keccak sponge function after clearing all sensitive information.
Definition: KeccakCore.cpp:61
KeccakCore::extract
void extract(void *data, size_t size)
Extracts data from the Keccak sponge function.
Definition: KeccakCore.cpp:201
@@ -334,7 +358,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/KeccakCore_8h_source.html b/KeccakCore_8h_source.html index ad3ad9fd..11d26f2d 100644 --- a/KeccakCore_8h_source.html +++ b/KeccakCore_8h_source.html @@ -136,20 +136,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
46 
47  void clear();
48 
-
49 private:
-
50  struct {
-
51  uint64_t A[5][5];
-
52  uint64_t B[5][5];
-
53  uint8_t inputSize;
-
54  uint8_t outputSize;
-
55  } state;
-
56  uint8_t _blockSize;
-
57 
-
58  void keccakp();
-
59 };
-
60 
-
61 #endif
+
49  void setHMACKey(const void *key, size_t len, uint8_t pad, size_t hashSize);
+
50 
+
51 private:
+
52  struct {
+
53  uint64_t A[5][5];
+
54  uint64_t B[5][5];
+
55  uint8_t inputSize;
+
56  uint8_t outputSize;
+
57  } state;
+
58  uint8_t _blockSize;
+
59 
+
60  void keccakp();
+
61 };
+
62 
+
63 #endif
KeccakCore::blockSize
size_t blockSize() const
Returns the input block size for the sponge function in bytes.
Definition: KeccakCore.h:38
+
KeccakCore::setHMACKey
void setHMACKey(const void *key, size_t len, uint8_t pad, size_t hashSize)
Sets a HMAC key for a Keccak-based hash algorithm.
Definition: KeccakCore.cpp:263
KeccakCore::setCapacity
void setCapacity(size_t capacity)
Sets the capacity of the Keccak sponge function in bits.
Definition: KeccakCore.cpp:89
KeccakCore::~KeccakCore
~KeccakCore()
Destroys this Keccak sponge function after clearing all sensitive information.
Definition: KeccakCore.cpp:61
KeccakCore::extract
void extract(void *data, size_t size)
Extracts data from the Keccak sponge function.
Definition: KeccakCore.cpp:201
@@ -163,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LCD_8cpp_source.html b/LCD_8cpp_source.html index 76d23dac..e3f17911 100644 --- a/LCD_8cpp_source.html +++ b/LCD_8cpp_source.html @@ -290,7 +290,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LCD_8h_source.html b/LCD_8h_source.html index 484d3c8f..d61070df 100644 --- a/LCD_8h_source.html +++ b/LCD_8h_source.html @@ -201,7 +201,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ListField_8cpp_source.html b/ListField_8cpp_source.html index 5377aa13..c06ee07c 100644 --- a/ListField_8cpp_source.html +++ b/ListField_8cpp_source.html @@ -221,7 +221,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ListField_8h_source.html b/ListField_8h_source.html index c52cb556..ae7767ae 100644 --- a/ListField_8h_source.html +++ b/ListField_8h_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Melody_8cpp_source.html b/Melody_8cpp_source.html index 514cac3e..dd11fa53 100644 --- a/Melody_8cpp_source.html +++ b/Melody_8cpp_source.html @@ -215,7 +215,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Melody_8h_source.html b/Melody_8h_source.html index c8f47f43..59882476 100644 --- a/Melody_8h_source.html +++ b/Melody_8h_source.html @@ -258,7 +258,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Mono5x7_8h_source.html b/Mono5x7_8h_source.html index 3e1abb02..da67bf5d 100644 --- a/Mono5x7_8h_source.html +++ b/Mono5x7_8h_source.html @@ -246,7 +246,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NoiseSource_8cpp_source.html b/NoiseSource_8cpp_source.html index 5a460460..c08b8314 100644 --- a/NoiseSource_8cpp_source.html +++ b/NoiseSource_8cpp_source.html @@ -128,11 +128,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
NoiseSource::NoiseSource
NoiseSource()
Constructs a new random noise source.
Definition: NoiseSource.cpp:36
NoiseSource::output
virtual void output(const uint8_t *data, size_t len, unsigned int credit)
Called from subclasses to output noise to the global random number pool.
Definition: NoiseSource.cpp:102
NoiseSource::~NoiseSource
virtual ~NoiseSource()
Destroys this random noise source.
Definition: NoiseSource.cpp:43
-
RNGClass::stir
void stir(const uint8_t *data, size_t len, unsigned int credit=0)
Stirs additional entropy data into the random pool.
Definition: RNG.cpp:387
+
RNGClass::stir
void stir(const uint8_t *data, size_t len, unsigned int credit=0)
Stirs additional entropy data into the random pool.
Definition: RNG.cpp:407
diff --git a/NoiseSource_8h_source.html b/NoiseSource_8h_source.html index 9bd6b645..728a4560 100644 --- a/NoiseSource_8h_source.html +++ b/NoiseSource_8h_source.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OFB_8cpp_source.html b/OFB_8cpp_source.html index bc749183..06658807 100644 --- a/OFB_8cpp_source.html +++ b/OFB_8cpp_source.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OFB_8h_source.html b/OFB_8h_source.html index ae497a9a..759d453a 100644 --- a/OFB_8h_source.html +++ b/OFB_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/PowerSave_8cpp_source.html b/PowerSave_8cpp_source.html index 0aa22da0..6632cd77 100644 --- a/PowerSave_8cpp_source.html +++ b/PowerSave_8cpp_source.html @@ -155,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/PowerSave_8h_source.html b/PowerSave_8h_source.html index a60bc456..34fb85a4 100644 --- a/PowerSave_8h_source.html +++ b/PowerSave_8h_source.html @@ -158,7 +158,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RC5_8h_source.html b/RC5_8h_source.html index 5856c56c..f7483324 100644 --- a/RC5_8h_source.html +++ b/RC5_8h_source.html @@ -435,7 +435,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RNG_8cpp_source.html b/RNG_8cpp_source.html index cd0018de..3597e567 100644 --- a/RNG_8cpp_source.html +++ b/RNG_8cpp_source.html @@ -158,214 +158,227 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
170  , firstSave(1)
171  , timer(0)
172  , timeout(3600000UL) // 1 hour in milliseconds
-
173 {
-
174 }
-
175 
-
179 RNGClass::~RNGClass()
-
180 {
-
181  clean(block);
-
182  clean(stream);
-
183 }
-
184 
-
202 void RNGClass::begin(const char *tag, int eepromAddress)
-
203 {
-
204  // Save the EEPROM address for use by save().
-
205  address = eepromAddress;
-
206 
-
207  // Initialize the ChaCha20 input block from the saved seed.
-
208  memcpy_P(block, tagRNG, sizeof(tagRNG));
-
209  memcpy_P(block + 4, initRNG, sizeof(initRNG));
-
210  if (eeprom_read_byte((const uint8_t *)address) == 'S') {
-
211  // We have a saved seed: XOR it with the initialization block.
-
212  for (int posn = 0; posn < 12; ++posn) {
-
213  block[posn + 4] ^=
-
214  eeprom_read_dword((const uint32_t *)(address + posn * 4 + 1));
-
215  }
-
216  }
-
217 
-
218  // No entropy credits for the saved seed.
-
219  credits = 0;
-
220 
-
221  // Trigger an automatic save once the entropy credits max out.
-
222  firstSave = 1;
-
223 
-
224  // Rekey the random number generator immediately.
-
225  rekey();
-
226 
-
227  // Stir in the supplied tag data but don't credit any entropy to it.
-
228  if (tag)
-
229  stir((const uint8_t *)tag, strlen(tag));
-
230 
-
231  // Re-save the seed to obliterate the previous value and to ensure
-
232  // that if the system is reset without a call to save() that we won't
-
233  // accidentally generate the same sequence of random data again.
-
234  save();
-
235 }
-
236 
-
253 void RNGClass::setAutoSaveTime(uint16_t minutes)
-
254 {
-
255  if (!minutes)
-
256  minutes = 1; // Just in case.
-
257  timeout = ((uint32_t)minutes) * 60000U;
-
258 }
-
259 
-
277 void RNGClass::rand(uint8_t *data, size_t len)
-
278 {
-
279  // Decrease the amount of entropy in the pool.
-
280  if (len > (credits / 8))
-
281  credits = 0;
-
282  else
-
283  credits -= len * 8;
-
284 
-
285  // Generate the random data.
-
286  uint8_t count = 0;
-
287  while (len > 0) {
-
288  // Force a rekey if we have generated too many blocks in this request.
-
289  if (count >= RNG_REKEY_BLOCKS) {
-
290  rekey();
-
291  count = 1;
-
292  } else {
-
293  ++count;
-
294  }
-
295 
-
296  // Increment the low counter word and generate a new keystream block.
-
297  ++(block[12]);
-
298  ChaCha::hashCore(stream, block, RNG_ROUNDS);
-
299 
-
300  // Copy the data to the return buffer.
-
301  if (len < 64) {
-
302  memcpy(data, stream, len);
-
303  break;
-
304  } else {
-
305  memcpy(data, stream, 64);
-
306  data += 64;
-
307  len -= 64;
-
308  }
-
309  }
-
310 
-
311  // Force a rekey after every request.
-
312  rekey();
-
313 }
-
314 
-
354 bool RNGClass::available(size_t len) const
-
355 {
-
356  if (len >= (RNG_MAX_CREDITS / 8))
-
357  return credits >= RNG_MAX_CREDITS;
-
358  else
-
359  return len <= (credits / 8);
-
360 }
-
361 
-
387 void RNGClass::stir(const uint8_t *data, size_t len, unsigned int credit)
-
388 {
-
389  // Increase the entropy credit.
-
390  if ((credit / 8) >= len)
-
391  credit = len * 8;
-
392  if ((RNG_MAX_CREDITS - credits) > credit)
-
393  credits += credit;
-
394  else
-
395  credits = RNG_MAX_CREDITS;
-
396 
-
397  // Process the supplied input data.
-
398  if (len > 0) {
-
399  // XOR the data with the ChaCha input block in 48 byte
-
400  // chunks and rekey the ChaCha cipher for each chunk to mix
-
401  // the data in. This should scatter any "true entropy" in
-
402  // the input across the entire block.
-
403  while (len > 0) {
-
404  size_t templen = len;
-
405  if (templen > 48)
-
406  templen = 48;
-
407  uint8_t *output = ((uint8_t *)block) + 16;
-
408  len -= templen;
-
409  while (templen > 0) {
-
410  *output++ ^= *data++;
-
411  --templen;
-
412  }
-
413  rekey();
-
414  }
-
415  } else {
-
416  // There was no input data, so just force a rekey so we
-
417  // get some mixing of the state even without new data.
-
418  rekey();
-
419  }
-
420 
-
421  // Save if this is the first time we have reached max entropy.
-
422  // This provides some protection if the system is powered off before
-
423  // the first auto-save timeout occurs.
-
424  if (firstSave && credits >= RNG_MAX_CREDITS) {
-
425  firstSave = 0;
-
426  save();
-
427  }
-
428 }
-
429 
-
437 void RNGClass::stir(NoiseSource &source)
-
438 {
-
439  source.stir();
-
440 }
-
441 
-
468 void RNGClass::save()
-
469 {
-
470  // Generate random data from the current state and save
-
471  // that as the seed. Then force a rekey.
-
472  ++(block[12]);
-
473  ChaCha::hashCore(stream, block, RNG_ROUNDS);
-
474  eeprom_write_block(stream, (void *)(address + 1), 48);
-
475  eeprom_update_byte((uint8_t *)address, 'S');
-
476  rekey();
-
477  timer = millis();
-
478 }
-
479 
-
486 void RNGClass::loop()
-
487 {
-
488  // Save the seed if the auto-save timer has expired.
-
489  if ((millis() - timer) >= timeout)
-
490  save();
-
491 }
-
492 
-
513 void RNGClass::destroy()
-
514 {
-
515  clean(block);
-
516  clean(stream);
-
517  for (int posn = 0; posn < SEED_SIZE; ++posn)
-
518  eeprom_write_byte((uint8_t *)(address + posn), 0xFF);
-
519 }
-
520 
-
524 void RNGClass::rekey()
-
525 {
-
526  // Rekey the cipher for the next request by generating a new block.
-
527  // This is intended to make it difficult to wind the random number
-
528  // backwards if the state is captured later. The first 16 bytes of
-
529  // "block" remain set to "tagRNG".
-
530  ++(block[12]);
-
531  ChaCha::hashCore(stream, block, RNG_ROUNDS);
-
532  memcpy(block + 4, stream, 48);
-
533 
-
534  // Permute the high word of the counter using the system microsecond
-
535  // counter to introduce a little bit of non-stir randomness for each
-
536  // request. Note: If random data is requested on a predictable schedule
-
537  // then this may not help very much. It is still necessary to stir in
-
538  // high quality entropy data on a regular basis using stir().
-
539  block[13] ^= micros();
-
540 }
-
RNGClass::save
void save()
Saves the random seed to EEPROM.
Definition: RNG.cpp:468
-
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:277
-
RNGClass::begin
void begin(const char *tag, int eepromAddress)
Initializes the random number generator.
Definition: RNG.cpp:202
+
173  , count(0)
+
174 {
+
175 }
+
176 
+
180 RNGClass::~RNGClass()
+
181 {
+
182  clean(block);
+
183  clean(stream);
+
184 }
+
185 
+
203 void RNGClass::begin(const char *tag, int eepromAddress)
+
204 {
+
205  // Save the EEPROM address for use by save().
+
206  address = eepromAddress;
+
207 
+
208  // Initialize the ChaCha20 input block from the saved seed.
+
209  memcpy_P(block, tagRNG, sizeof(tagRNG));
+
210  memcpy_P(block + 4, initRNG, sizeof(initRNG));
+
211  if (eeprom_read_byte((const uint8_t *)address) == 'S') {
+
212  // We have a saved seed: XOR it with the initialization block.
+
213  for (int posn = 0; posn < 12; ++posn) {
+
214  block[posn + 4] ^=
+
215  eeprom_read_dword((const uint32_t *)(address + posn * 4 + 1));
+
216  }
+
217  }
+
218 
+
219  // No entropy credits for the saved seed.
+
220  credits = 0;
+
221 
+
222  // Trigger an automatic save once the entropy credits max out.
+
223  firstSave = 1;
+
224 
+
225  // Rekey the random number generator immediately.
+
226  rekey();
+
227 
+
228  // Stir in the supplied tag data but don't credit any entropy to it.
+
229  if (tag)
+
230  stir((const uint8_t *)tag, strlen(tag));
+
231 
+
232  // Re-save the seed to obliterate the previous value and to ensure
+
233  // that if the system is reset without a call to save() that we won't
+
234  // accidentally generate the same sequence of random data again.
+
235  save();
+
236 }
+
237 
+
250 void RNGClass::addNoiseSource(NoiseSource &source)
+
251 {
+
252  #define MAX_NOISE_SOURCES (sizeof(noiseSources) / sizeof(noiseSources[0]))
+
253  if (count < MAX_NOISE_SOURCES)
+
254  noiseSources[count++] = &source;
+
255 }
+
256 
+
273 void RNGClass::setAutoSaveTime(uint16_t minutes)
+
274 {
+
275  if (!minutes)
+
276  minutes = 1; // Just in case.
+
277  timeout = ((uint32_t)minutes) * 60000U;
+
278 }
+
279 
+
297 void RNGClass::rand(uint8_t *data, size_t len)
+
298 {
+
299  // Decrease the amount of entropy in the pool.
+
300  if (len > (credits / 8))
+
301  credits = 0;
+
302  else
+
303  credits -= len * 8;
+
304 
+
305  // Generate the random data.
+
306  uint8_t count = 0;
+
307  while (len > 0) {
+
308  // Force a rekey if we have generated too many blocks in this request.
+
309  if (count >= RNG_REKEY_BLOCKS) {
+
310  rekey();
+
311  count = 1;
+
312  } else {
+
313  ++count;
+
314  }
+
315 
+
316  // Increment the low counter word and generate a new keystream block.
+
317  ++(block[12]);
+
318  ChaCha::hashCore(stream, block, RNG_ROUNDS);
+
319 
+
320  // Copy the data to the return buffer.
+
321  if (len < 64) {
+
322  memcpy(data, stream, len);
+
323  break;
+
324  } else {
+
325  memcpy(data, stream, 64);
+
326  data += 64;
+
327  len -= 64;
+
328  }
+
329  }
+
330 
+
331  // Force a rekey after every request.
+
332  rekey();
+
333 }
+
334 
+
374 bool RNGClass::available(size_t len) const
+
375 {
+
376  if (len >= (RNG_MAX_CREDITS / 8))
+
377  return credits >= RNG_MAX_CREDITS;
+
378  else
+
379  return len <= (credits / 8);
+
380 }
+
381 
+
407 void RNGClass::stir(const uint8_t *data, size_t len, unsigned int credit)
+
408 {
+
409  // Increase the entropy credit.
+
410  if ((credit / 8) >= len)
+
411  credit = len * 8;
+
412  if ((RNG_MAX_CREDITS - credits) > credit)
+
413  credits += credit;
+
414  else
+
415  credits = RNG_MAX_CREDITS;
+
416 
+
417  // Process the supplied input data.
+
418  if (len > 0) {
+
419  // XOR the data with the ChaCha input block in 48 byte
+
420  // chunks and rekey the ChaCha cipher for each chunk to mix
+
421  // the data in. This should scatter any "true entropy" in
+
422  // the input across the entire block.
+
423  while (len > 0) {
+
424  size_t templen = len;
+
425  if (templen > 48)
+
426  templen = 48;
+
427  uint8_t *output = ((uint8_t *)block) + 16;
+
428  len -= templen;
+
429  while (templen > 0) {
+
430  *output++ ^= *data++;
+
431  --templen;
+
432  }
+
433  rekey();
+
434  }
+
435  } else {
+
436  // There was no input data, so just force a rekey so we
+
437  // get some mixing of the state even without new data.
+
438  rekey();
+
439  }
+
440 
+
441  // Save if this is the first time we have reached max entropy.
+
442  // This provides some protection if the system is powered off before
+
443  // the first auto-save timeout occurs.
+
444  if (firstSave && credits >= RNG_MAX_CREDITS) {
+
445  firstSave = 0;
+
446  save();
+
447  }
+
448 }
+
449 
+
457 void RNGClass::stir(NoiseSource &source)
+
458 {
+
459  source.stir();
+
460 }
+
461 
+
488 void RNGClass::save()
+
489 {
+
490  // Generate random data from the current state and save
+
491  // that as the seed. Then force a rekey.
+
492  ++(block[12]);
+
493  ChaCha::hashCore(stream, block, RNG_ROUNDS);
+
494  eeprom_write_block(stream, (void *)(address + 1), 48);
+
495  eeprom_update_byte((uint8_t *)address, 'S');
+
496  rekey();
+
497  timer = millis();
+
498 }
+
499 
+
506 void RNGClass::loop()
+
507 {
+
508  // Stir in the entropy from all registered noise sources.
+
509  for (uint8_t posn = 0; posn < count; ++posn)
+
510  noiseSources[posn]->stir();
+
511 
+
512  // Save the seed if the auto-save timer has expired.
+
513  if ((millis() - timer) >= timeout)
+
514  save();
+
515 }
+
516 
+
537 void RNGClass::destroy()
+
538 {
+
539  clean(block);
+
540  clean(stream);
+
541  for (int posn = 0; posn < SEED_SIZE; ++posn)
+
542  eeprom_write_byte((uint8_t *)(address + posn), 0xFF);
+
543 }
+
544 
+
548 void RNGClass::rekey()
+
549 {
+
550  // Rekey the cipher for the next request by generating a new block.
+
551  // This is intended to make it difficult to wind the random number
+
552  // backwards if the state is captured later. The first 16 bytes of
+
553  // "block" remain set to "tagRNG".
+
554  ++(block[12]);
+
555  ChaCha::hashCore(stream, block, RNG_ROUNDS);
+
556  memcpy(block + 4, stream, 48);
+
557 
+
558  // Permute the high word of the counter using the system microsecond
+
559  // counter to introduce a little bit of non-stir randomness for each
+
560  // request. Note: If random data is requested on a predictable schedule
+
561  // then this may not help very much. It is still necessary to stir in
+
562  // high quality entropy data on a regular basis using stir().
+
563  block[13] ^= micros();
+
564 }
+
RNGClass::save
void save()
Saves the random seed to EEPROM.
Definition: RNG.cpp:488
+
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:297
+
RNGClass::begin
void begin(const char *tag, int eepromAddress)
Initializes the random number generator.
Definition: RNG.cpp:203
NoiseSource::stir
virtual void stir()=0
Stirs entropy from this noise source into the global random number pool.
NoiseSource
Abstract base class for random noise sources.
Definition: NoiseSource.h:29
-
RNGClass::~RNGClass
~RNGClass()
Destroys this random number generator instance.
Definition: RNG.cpp:179
+
RNGClass::~RNGClass
~RNGClass()
Destroys this random number generator instance.
Definition: RNG.cpp:180
+
RNGClass::addNoiseSource
void addNoiseSource(NoiseSource &source)
Adds a noise source to the random number generator.
Definition: RNG.cpp:250
RNGClass::RNGClass
RNGClass()
Constructs a new random number generator instance.
Definition: RNG.cpp:167
-
RNGClass::destroy
void destroy()
Destroys the data in the random number pool and the saved seed in EEPROM.
Definition: RNG.cpp:513
-
RNGClass::available
bool available(size_t len) const
Determine if there is sufficient entropy available for a specific request size.
Definition: RNG.cpp:354
-
RNGClass::loop
void loop()
Run periodic housekeeping tasks on the random number generator.
Definition: RNG.cpp:486
+
RNGClass::destroy
void destroy()
Destroys the data in the random number pool and the saved seed in EEPROM.
Definition: RNG.cpp:537
+
RNGClass::available
bool available(size_t len) const
Determine if there is sufficient entropy available for a specific request size.
Definition: RNG.cpp:374
+
RNGClass::loop
void loop()
Run periodic housekeeping tasks on the random number generator.
Definition: RNG.cpp:506
RNGClass
Pseudo random number generator suitable for cryptography.
Definition: RNG.h:31
-
RNGClass::SEED_SIZE
static const int SEED_SIZE
Size of a saved random number seed in EEPROM space.
Definition: RNG.h:53
+
RNGClass::SEED_SIZE
static const int SEED_SIZE
Size of a saved random number seed in EEPROM space.
Definition: RNG.h:54
ChaCha::hashCore
static void hashCore(uint32_t *output, const uint32_t *input, uint8_t rounds)
Executes the ChaCha hash core on an input memory block.
Definition: ChaCha.cpp:230
-
RNGClass::stir
void stir(const uint8_t *data, size_t len, unsigned int credit=0)
Stirs additional entropy data into the random pool.
Definition: RNG.cpp:387
-
RNGClass::setAutoSaveTime
void setAutoSaveTime(uint16_t minutes)
Sets the amount of time between automatic seed saves.
Definition: RNG.cpp:253
+
RNGClass::stir
void stir(const uint8_t *data, size_t len, unsigned int credit=0)
Stirs additional entropy data into the random pool.
Definition: RNG.cpp:407
+
RNGClass::setAutoSaveTime
void setAutoSaveTime(uint16_t minutes)
Sets the amount of time between automatic seed saves.
Definition: RNG.cpp:273
diff --git a/RNG_8h_source.html b/RNG_8h_source.html index 6e2d19dc..8d1f8293 100644 --- a/RNG_8h_source.html +++ b/RNG_8h_source.html @@ -125,55 +125,59 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
35  ~RNGClass();
36 
37  void begin(const char *tag, int eepromAddress);
-
38 
-
39  void setAutoSaveTime(uint16_t minutes);
-
40 
-
41  void rand(uint8_t *data, size_t len);
-
42  bool available(size_t len) const;
-
43 
-
44  void stir(const uint8_t *data, size_t len, unsigned int credit = 0);
-
45  void stir(NoiseSource &source);
-
46 
-
47  void save();
-
48 
-
49  void loop();
-
50 
-
51  void destroy();
-
52 
-
53  static const int SEED_SIZE = 49;
-
54 
-
55 private:
-
56  uint32_t block[16];
-
57  uint32_t stream[16];
-
58  int address;
-
59  uint16_t credits : 15;
-
60  uint16_t firstSave : 1;
-
61  unsigned long timer;
-
62  unsigned long timeout;
-
63 
-
64  void rekey();
-
65 };
+
38  void addNoiseSource(NoiseSource &source);
+
39 
+
40  void setAutoSaveTime(uint16_t minutes);
+
41 
+
42  void rand(uint8_t *data, size_t len);
+
43  bool available(size_t len) const;
+
44 
+
45  void stir(const uint8_t *data, size_t len, unsigned int credit = 0);
+
46  void stir(NoiseSource &source);
+
47 
+
48  void save();
+
49 
+
50  void loop();
+
51 
+
52  void destroy();
+
53 
+
54  static const int SEED_SIZE = 49;
+
55 
+
56 private:
+
57  uint32_t block[16];
+
58  uint32_t stream[16];
+
59  int address;
+
60  uint16_t credits : 15;
+
61  uint16_t firstSave : 1;
+
62  unsigned long timer;
+
63  unsigned long timeout;
+
64  NoiseSource *noiseSources[4];
+
65  uint8_t count;
66 
-
67 extern RNGClass RNG;
-
68 
-
69 #endif
-
RNGClass::save
void save()
Saves the random seed to EEPROM.
Definition: RNG.cpp:468
-
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:277
-
RNGClass::begin
void begin(const char *tag, int eepromAddress)
Initializes the random number generator.
Definition: RNG.cpp:202
+
67  void rekey();
+
68 };
+
69 
+
70 extern RNGClass RNG;
+
71 
+
72 #endif
+
RNGClass::save
void save()
Saves the random seed to EEPROM.
Definition: RNG.cpp:488
+
RNGClass::rand
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:297
+
RNGClass::begin
void begin(const char *tag, int eepromAddress)
Initializes the random number generator.
Definition: RNG.cpp:203
NoiseSource
Abstract base class for random noise sources.
Definition: NoiseSource.h:29
-
RNGClass::~RNGClass
~RNGClass()
Destroys this random number generator instance.
Definition: RNG.cpp:179
+
RNGClass::~RNGClass
~RNGClass()
Destroys this random number generator instance.
Definition: RNG.cpp:180
+
RNGClass::addNoiseSource
void addNoiseSource(NoiseSource &source)
Adds a noise source to the random number generator.
Definition: RNG.cpp:250
RNGClass::RNGClass
RNGClass()
Constructs a new random number generator instance.
Definition: RNG.cpp:167
-
RNGClass::destroy
void destroy()
Destroys the data in the random number pool and the saved seed in EEPROM.
Definition: RNG.cpp:513
-
RNGClass::available
bool available(size_t len) const
Determine if there is sufficient entropy available for a specific request size.
Definition: RNG.cpp:354
-
RNGClass::loop
void loop()
Run periodic housekeeping tasks on the random number generator.
Definition: RNG.cpp:486
+
RNGClass::destroy
void destroy()
Destroys the data in the random number pool and the saved seed in EEPROM.
Definition: RNG.cpp:537
+
RNGClass::available
bool available(size_t len) const
Determine if there is sufficient entropy available for a specific request size.
Definition: RNG.cpp:374
+
RNGClass::loop
void loop()
Run periodic housekeeping tasks on the random number generator.
Definition: RNG.cpp:506
RNGClass
Pseudo random number generator suitable for cryptography.
Definition: RNG.h:31
-
RNGClass::SEED_SIZE
static const int SEED_SIZE
Size of a saved random number seed in EEPROM space.
Definition: RNG.h:53
-
RNGClass::stir
void stir(const uint8_t *data, size_t len, unsigned int credit=0)
Stirs additional entropy data into the random pool.
Definition: RNG.cpp:387
-
RNGClass::setAutoSaveTime
void setAutoSaveTime(uint16_t minutes)
Sets the amount of time between automatic seed saves.
Definition: RNG.cpp:253
+
RNGClass::SEED_SIZE
static const int SEED_SIZE
Size of a saved random number seed in EEPROM space.
Definition: RNG.h:54
+
RNGClass::stir
void stir(const uint8_t *data, size_t len, unsigned int credit=0)
Stirs additional entropy data into the random pool.
Definition: RNG.cpp:407
+
RNGClass::setAutoSaveTime
void setAutoSaveTime(uint16_t minutes)
Sets the amount of time between automatic seed saves.
Definition: RNG.cpp:273
diff --git a/RTC_8cpp_source.html b/RTC_8cpp_source.html index 9bbc14c0..50a33c52 100644 --- a/RTC_8cpp_source.html +++ b/RTC_8cpp_source.html @@ -380,7 +380,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RTC_8h_source.html b/RTC_8h_source.html index 6151a573..9848950c 100644 --- a/RTC_8h_source.html +++ b/RTC_8h_source.html @@ -231,7 +231,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RingOscillatorNoiseSource_8cpp_source.html b/RingOscillatorNoiseSource_8cpp_source.html index e20dc95b..9ff157f1 100644 --- a/RingOscillatorNoiseSource_8cpp_source.html +++ b/RingOscillatorNoiseSource_8cpp_source.html @@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RingOscillatorNoiseSource_8h_source.html b/RingOscillatorNoiseSource_8h_source.html index 1acb4d25..b3d9ec75 100644 --- a/RingOscillatorNoiseSource_8h_source.html +++ b/RingOscillatorNoiseSource_8h_source.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA1_8cpp_source.html b/SHA1_8cpp_source.html index e0af757c..784297c4 100644 --- a/SHA1_8cpp_source.html +++ b/SHA1_8cpp_source.html @@ -206,102 +206,124 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
131  reset();
132 }
133 
-
139 void SHA1::processChunk()
-
140 {
-
141  uint8_t index;
-
142 
-
143  // Convert the first 16 words from big endian to host byte order.
-
144  for (index = 0; index < 16; ++index)
-
145  state.w[index] = be32toh(state.w[index]);
-
146 
-
147  // Initialize the hash value for this chunk.
-
148  uint32_t a = state.h[0];
-
149  uint32_t b = state.h[1];
-
150  uint32_t c = state.h[2];
-
151  uint32_t d = state.h[3];
-
152  uint32_t e = state.h[4];
-
153 
-
154  // Perform the first 16 rounds of the compression function main loop.
-
155  uint32_t temp;
-
156  for (index = 0; index < 16; ++index) {
-
157  temp = leftRotate5(a) + ((b & c) | ((~b) & d)) + e + 0x5A827999 + state.w[index];
-
158  e = d;
-
159  d = c;
-
160  c = leftRotate30(b);
-
161  b = a;
-
162  a = temp;
-
163  }
-
164 
-
165  // Perform the 64 remaining rounds. We expand the first 16 words to
-
166  // 80 in-place in the "w" array. This saves 256 bytes of memory
-
167  // that would have otherwise need to be allocated to the "w" array.
-
168  for (; index < 20; ++index) {
-
169  temp = state.w[index & 0x0F] = leftRotate1
-
170  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
-
171  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
-
172  temp = leftRotate5(a) + ((b & c) | ((~b) & d)) + e + 0x5A827999 + temp;
-
173  e = d;
-
174  d = c;
-
175  c = leftRotate30(b);
-
176  b = a;
-
177  a = temp;
-
178  }
-
179  for (; index < 40; ++index) {
-
180  temp = state.w[index & 0x0F] = leftRotate1
-
181  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
-
182  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
-
183  temp = leftRotate5(a) + (b ^ c ^ d) + e + 0x6ED9EBA1 + temp;
-
184  e = d;
-
185  d = c;
-
186  c = leftRotate30(b);
-
187  b = a;
-
188  a = temp;
-
189  }
-
190  for (; index < 60; ++index) {
-
191  temp = state.w[index & 0x0F] = leftRotate1
-
192  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
-
193  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
-
194  temp = leftRotate5(a) + ((b & c) | (b & d) | (c & d)) + e + 0x8F1BBCDC + temp;
-
195  e = d;
-
196  d = c;
-
197  c = leftRotate30(b);
-
198  b = a;
-
199  a = temp;
-
200  }
-
201  for (; index < 80; ++index) {
-
202  temp = state.w[index & 0x0F] = leftRotate1
-
203  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
-
204  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
-
205  temp = leftRotate5(a) + (b ^ c ^ d) + e + 0xCA62C1D6 + temp;
-
206  e = d;
-
207  d = c;
-
208  c = leftRotate30(b);
-
209  b = a;
-
210  a = temp;
-
211  }
-
212 
-
213  // Add this chunk's hash to the result so far.
-
214  state.h[0] += a;
-
215  state.h[1] += b;
-
216  state.h[2] += c;
-
217  state.h[3] += d;
-
218  state.h[4] += e;
-
219 
-
220  // Attempt to clean up the stack.
-
221  a = b = c = d = e = temp = 0;
-
222 }
+
134 void SHA1::resetHMAC(const void *key, size_t keyLen)
+
135 {
+
136  formatHMACKey(state.w, key, keyLen, 0x36);
+
137  state.length += 64 * 8;
+
138  processChunk();
+
139 }
+
140 
+
141 void SHA1::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
142 {
+
143  uint8_t temp[20];
+
144  finalize(temp, sizeof(temp));
+
145  formatHMACKey(state.w, key, keyLen, 0x5C);
+
146  state.length += 64 * 8;
+
147  processChunk();
+
148  update(temp, sizeof(temp));
+
149  finalize(hash, hashLen);
+
150  clean(temp);
+
151 }
+
152 
+
158 void SHA1::processChunk()
+
159 {
+
160  uint8_t index;
+
161 
+
162  // Convert the first 16 words from big endian to host byte order.
+
163  for (index = 0; index < 16; ++index)
+
164  state.w[index] = be32toh(state.w[index]);
+
165 
+
166  // Initialize the hash value for this chunk.
+
167  uint32_t a = state.h[0];
+
168  uint32_t b = state.h[1];
+
169  uint32_t c = state.h[2];
+
170  uint32_t d = state.h[3];
+
171  uint32_t e = state.h[4];
+
172 
+
173  // Perform the first 16 rounds of the compression function main loop.
+
174  uint32_t temp;
+
175  for (index = 0; index < 16; ++index) {
+
176  temp = leftRotate5(a) + ((b & c) | ((~b) & d)) + e + 0x5A827999 + state.w[index];
+
177  e = d;
+
178  d = c;
+
179  c = leftRotate30(b);
+
180  b = a;
+
181  a = temp;
+
182  }
+
183 
+
184  // Perform the 64 remaining rounds. We expand the first 16 words to
+
185  // 80 in-place in the "w" array. This saves 256 bytes of memory
+
186  // that would have otherwise need to be allocated to the "w" array.
+
187  for (; index < 20; ++index) {
+
188  temp = state.w[index & 0x0F] = leftRotate1
+
189  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
+
190  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
+
191  temp = leftRotate5(a) + ((b & c) | ((~b) & d)) + e + 0x5A827999 + temp;
+
192  e = d;
+
193  d = c;
+
194  c = leftRotate30(b);
+
195  b = a;
+
196  a = temp;
+
197  }
+
198  for (; index < 40; ++index) {
+
199  temp = state.w[index & 0x0F] = leftRotate1
+
200  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
+
201  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
+
202  temp = leftRotate5(a) + (b ^ c ^ d) + e + 0x6ED9EBA1 + temp;
+
203  e = d;
+
204  d = c;
+
205  c = leftRotate30(b);
+
206  b = a;
+
207  a = temp;
+
208  }
+
209  for (; index < 60; ++index) {
+
210  temp = state.w[index & 0x0F] = leftRotate1
+
211  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
+
212  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
+
213  temp = leftRotate5(a) + ((b & c) | (b & d) | (c & d)) + e + 0x8F1BBCDC + temp;
+
214  e = d;
+
215  d = c;
+
216  c = leftRotate30(b);
+
217  b = a;
+
218  a = temp;
+
219  }
+
220  for (; index < 80; ++index) {
+
221  temp = state.w[index & 0x0F] = leftRotate1
+
222  (state.w[(index - 3) & 0x0F] ^ state.w[(index - 8) & 0x0F] ^
+
223  state.w[(index - 14) & 0x0F] ^ state.w[(index - 16) & 0x0F]);
+
224  temp = leftRotate5(a) + (b ^ c ^ d) + e + 0xCA62C1D6 + temp;
+
225  e = d;
+
226  d = c;
+
227  c = leftRotate30(b);
+
228  b = a;
+
229  a = temp;
+
230  }
+
231 
+
232  // Add this chunk's hash to the result so far.
+
233  state.h[0] += a;
+
234  state.h[1] += b;
+
235  state.h[2] += c;
+
236  state.h[3] += d;
+
237  state.h[4] += e;
+
238 
+
239  // Attempt to clean up the stack.
+
240  a = b = c = d = e = temp = 0;
+
241 }
+
SHA1::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA1.cpp:134
SHA1::~SHA1
virtual ~SHA1()
Destroys this SHA-1 hash object after clearing sensitive information.
Definition: SHA1.cpp:49
SHA1::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA1.cpp:64
SHA1::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA1.cpp:75
SHA1::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA1.cpp:128
SHA1::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA1.cpp:59
SHA1::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA1.cpp:97
+
SHA1::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA1.cpp:141
SHA1::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA1.cpp:54
SHA1::SHA1
SHA1()
Constructs a SHA-1 hash object.
Definition: SHA1.cpp:41
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
diff --git a/SHA1_8h_source.html b/SHA1_8h_source.html index 0f012319..9a832bd5 100644 --- a/SHA1_8h_source.html +++ b/SHA1_8h_source.html @@ -130,18 +130,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
40 
41  void clear();
42 
-
43 private:
-
44  struct {
-
45  uint32_t h[5];
-
46  uint32_t w[16];
-
47  uint64_t length;
-
48  uint8_t chunkSize;
-
49  } state;
-
50 
-
51  void processChunk();
-
52 };
+
43  void resetHMAC(const void *key, size_t keyLen);
+
44  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
45 
+
46 private:
+
47  struct {
+
48  uint32_t h[5];
+
49  uint32_t w[16];
+
50  uint64_t length;
+
51  uint8_t chunkSize;
+
52  } state;
53 
-
54 #endif
+
54  void processChunk();
+
55 };
+
56 
+
57 #endif
+
SHA1::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA1.cpp:134
SHA1::~SHA1
virtual ~SHA1()
Destroys this SHA-1 hash object after clearing sensitive information.
Definition: SHA1.cpp:49
SHA1::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA1.cpp:64
Hash
Abstract base class for cryptographic hash algorithms.
Definition: Hash.h:29
@@ -150,12 +154,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SHA1::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA1.cpp:59
SHA1
SHA-1 hash algorithm.
Definition: SHA1.h:28
SHA1::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA1.cpp:97
+
SHA1::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA1.cpp:141
SHA1::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA1.cpp:54
SHA1::SHA1
SHA1()
Constructs a SHA-1 hash object.
Definition: SHA1.cpp:41
diff --git a/SHA256_8cpp_source.html b/SHA256_8cpp_source.html index ebdfcb46..afbd3b93 100644 --- a/SHA256_8cpp_source.html +++ b/SHA256_8cpp_source.html @@ -210,114 +210,136 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
136  reset();
137 }
138 
-
144 void SHA256::processChunk()
-
145 {
-
146  // Round constants for SHA-256.
-
147  static uint32_t const k[64] PROGMEM = {
-
148  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
-
149  0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
-
150  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
-
151  0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
-
152  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
-
153  0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
-
154  0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
-
155  0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
-
156  0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
-
157  0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
-
158  0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
-
159  0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
-
160  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
-
161  0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
-
162  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
-
163  0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
-
164  };
-
165 
-
166  // Convert the first 16 words from big endian to host byte order.
-
167  uint8_t index;
-
168  for (index = 0; index < 16; ++index)
-
169  state.w[index] = be32toh(state.w[index]);
-
170 
-
171  // Initialise working variables to the current hash value.
-
172  uint32_t a = state.h[0];
-
173  uint32_t b = state.h[1];
-
174  uint32_t c = state.h[2];
-
175  uint32_t d = state.h[3];
-
176  uint32_t e = state.h[4];
-
177  uint32_t f = state.h[5];
-
178  uint32_t g = state.h[6];
-
179  uint32_t h = state.h[7];
-
180 
-
181  // Perform the first 16 rounds of the compression function main loop.
-
182  uint32_t temp1, temp2;
-
183  for (index = 0; index < 16; ++index) {
-
184  temp1 = h + pgm_read_dword(k + index) + state.w[index] +
-
185  (rightRotate6(e) ^ rightRotate11(e) ^ rightRotate25(e)) +
-
186  ((e & f) ^ ((~e) & g));
-
187  temp2 = (rightRotate2(a) ^ rightRotate13(a) ^ rightRotate22(a)) +
-
188  ((a & b) ^ (a & c) ^ (b & c));
-
189  h = g;
-
190  g = f;
-
191  f = e;
-
192  e = d + temp1;
-
193  d = c;
-
194  c = b;
-
195  b = a;
-
196  a = temp1 + temp2;
-
197  }
-
198 
-
199  // Perform the 48 remaining rounds. We expand the first 16 words to
-
200  // 64 in-place in the "w" array. This saves 192 bytes of memory
-
201  // that would have otherwise need to be allocated to the "w" array.
-
202  for (; index < 64; ++index) {
-
203  // Expand the next word.
-
204  temp1 = state.w[(index - 15) & 0x0F];
-
205  temp2 = state.w[(index - 2) & 0x0F];
-
206  temp1 = state.w[index & 0x0F] =
-
207  state.w[(index - 16) & 0x0F] + state.w[(index - 7) & 0x0F] +
-
208  (rightRotate7(temp1) ^ rightRotate18(temp1) ^ (temp1 >> 3)) +
-
209  (rightRotate17(temp2) ^ rightRotate19(temp2) ^ (temp2 >> 10));
-
210 
-
211  // Perform the round.
-
212  temp1 = h + pgm_read_dword(k + index) + temp1 +
-
213  (rightRotate6(e) ^ rightRotate11(e) ^ rightRotate25(e)) +
-
214  ((e & f) ^ ((~e) & g));
-
215  temp2 = (rightRotate2(a) ^ rightRotate13(a) ^ rightRotate22(a)) +
-
216  ((a & b) ^ (a & c) ^ (b & c));
-
217  h = g;
-
218  g = f;
-
219  f = e;
-
220  e = d + temp1;
-
221  d = c;
-
222  c = b;
-
223  b = a;
-
224  a = temp1 + temp2;
-
225  }
-
226 
-
227  // Add the compressed chunk to the current hash value.
-
228  state.h[0] += a;
-
229  state.h[1] += b;
-
230  state.h[2] += c;
-
231  state.h[3] += d;
-
232  state.h[4] += e;
-
233  state.h[5] += f;
-
234  state.h[6] += g;
-
235  state.h[7] += h;
-
236 
-
237  // Attempt to clean up the stack.
-
238  a = b = c = d = e = f = g = h = temp1 = temp2 = 0;
-
239 }
+
139 void SHA256::resetHMAC(const void *key, size_t keyLen)
+
140 {
+
141  formatHMACKey(state.w, key, keyLen, 0x36);
+
142  state.length += 64 * 8;
+
143  processChunk();
+
144 }
+
145 
+
146 void SHA256::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
147 {
+
148  uint8_t temp[32];
+
149  finalize(temp, sizeof(temp));
+
150  formatHMACKey(state.w, key, keyLen, 0x5C);
+
151  state.length += 64 * 8;
+
152  processChunk();
+
153  update(temp, sizeof(temp));
+
154  finalize(hash, hashLen);
+
155  clean(temp);
+
156 }
+
157 
+
163 void SHA256::processChunk()
+
164 {
+
165  // Round constants for SHA-256.
+
166  static uint32_t const k[64] PROGMEM = {
+
167  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+
168  0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+
169  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+
170  0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+
171  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+
172  0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+
173  0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+
174  0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+
175  0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+
176  0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+
177  0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+
178  0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+
179  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+
180  0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+
181  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+
182  0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+
183  };
+
184 
+
185  // Convert the first 16 words from big endian to host byte order.
+
186  uint8_t index;
+
187  for (index = 0; index < 16; ++index)
+
188  state.w[index] = be32toh(state.w[index]);
+
189 
+
190  // Initialise working variables to the current hash value.
+
191  uint32_t a = state.h[0];
+
192  uint32_t b = state.h[1];
+
193  uint32_t c = state.h[2];
+
194  uint32_t d = state.h[3];
+
195  uint32_t e = state.h[4];
+
196  uint32_t f = state.h[5];
+
197  uint32_t g = state.h[6];
+
198  uint32_t h = state.h[7];
+
199 
+
200  // Perform the first 16 rounds of the compression function main loop.
+
201  uint32_t temp1, temp2;
+
202  for (index = 0; index < 16; ++index) {
+
203  temp1 = h + pgm_read_dword(k + index) + state.w[index] +
+
204  (rightRotate6(e) ^ rightRotate11(e) ^ rightRotate25(e)) +
+
205  ((e & f) ^ ((~e) & g));
+
206  temp2 = (rightRotate2(a) ^ rightRotate13(a) ^ rightRotate22(a)) +
+
207  ((a & b) ^ (a & c) ^ (b & c));
+
208  h = g;
+
209  g = f;
+
210  f = e;
+
211  e = d + temp1;
+
212  d = c;
+
213  c = b;
+
214  b = a;
+
215  a = temp1 + temp2;
+
216  }
+
217 
+
218  // Perform the 48 remaining rounds. We expand the first 16 words to
+
219  // 64 in-place in the "w" array. This saves 192 bytes of memory
+
220  // that would have otherwise need to be allocated to the "w" array.
+
221  for (; index < 64; ++index) {
+
222  // Expand the next word.
+
223  temp1 = state.w[(index - 15) & 0x0F];
+
224  temp2 = state.w[(index - 2) & 0x0F];
+
225  temp1 = state.w[index & 0x0F] =
+
226  state.w[(index - 16) & 0x0F] + state.w[(index - 7) & 0x0F] +
+
227  (rightRotate7(temp1) ^ rightRotate18(temp1) ^ (temp1 >> 3)) +
+
228  (rightRotate17(temp2) ^ rightRotate19(temp2) ^ (temp2 >> 10));
+
229 
+
230  // Perform the round.
+
231  temp1 = h + pgm_read_dword(k + index) + temp1 +
+
232  (rightRotate6(e) ^ rightRotate11(e) ^ rightRotate25(e)) +
+
233  ((e & f) ^ ((~e) & g));
+
234  temp2 = (rightRotate2(a) ^ rightRotate13(a) ^ rightRotate22(a)) +
+
235  ((a & b) ^ (a & c) ^ (b & c));
+
236  h = g;
+
237  g = f;
+
238  f = e;
+
239  e = d + temp1;
+
240  d = c;
+
241  c = b;
+
242  b = a;
+
243  a = temp1 + temp2;
+
244  }
+
245 
+
246  // Add the compressed chunk to the current hash value.
+
247  state.h[0] += a;
+
248  state.h[1] += b;
+
249  state.h[2] += c;
+
250  state.h[3] += d;
+
251  state.h[4] += e;
+
252  state.h[5] += f;
+
253  state.h[6] += g;
+
254  state.h[7] += h;
+
255 
+
256  // Attempt to clean up the stack.
+
257  a = b = c = d = e = f = g = h = temp1 = temp2 = 0;
+
258 }
SHA256::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA256.cpp:66
SHA256::SHA256
SHA256()
Constructs a SHA-256 hash object.
Definition: SHA256.cpp:42
SHA256::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA256.cpp:102
SHA256::~SHA256
virtual ~SHA256()
Destroys this SHA-256 hash object after clearing sensitive information.
Definition: SHA256.cpp:51
SHA256::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA256.cpp:61
+
SHA256::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA256.cpp:146
SHA256::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA256.cpp:80
SHA256::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA256.cpp:56
SHA256::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA256.cpp:133
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
+
SHA256::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA256.cpp:139
diff --git a/SHA256_8h_source.html b/SHA256_8h_source.html index 5b9f54a0..fbe93a83 100644 --- a/SHA256_8h_source.html +++ b/SHA256_8h_source.html @@ -130,18 +130,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
40 
41  void clear();
42 
-
43 private:
-
44  struct {
-
45  uint32_t h[8];
-
46  uint32_t w[16];
-
47  uint64_t length;
-
48  uint8_t chunkSize;
-
49  } state;
-
50 
-
51  void processChunk();
-
52 };
+
43  void resetHMAC(const void *key, size_t keyLen);
+
44  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
45 
+
46 private:
+
47  struct {
+
48  uint32_t h[8];
+
49  uint32_t w[16];
+
50  uint64_t length;
+
51  uint8_t chunkSize;
+
52  } state;
53 
-
54 #endif
+
54  void processChunk();
+
55 };
+
56 
+
57 #endif
SHA256::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA256.cpp:66
SHA256::SHA256
SHA256()
Constructs a SHA-256 hash object.
Definition: SHA256.cpp:42
Hash
Abstract base class for cryptographic hash algorithms.
Definition: Hash.h:29
@@ -149,13 +152,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SHA256::~SHA256
virtual ~SHA256()
Destroys this SHA-256 hash object after clearing sensitive information.
Definition: SHA256.cpp:51
SHA256
SHA-256 hash algorithm.
Definition: SHA256.h:28
SHA256::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA256.cpp:61
+
SHA256::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA256.cpp:146
SHA256::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA256.cpp:80
SHA256::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA256.cpp:56
SHA256::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA256.cpp:133
+
SHA256::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA256.cpp:139
diff --git a/SHA3_8cpp_source.html b/SHA3_8cpp_source.html index f5b28b02..baa9c25e 100644 --- a/SHA3_8cpp_source.html +++ b/SHA3_8cpp_source.html @@ -111,117 +111,153 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
21  */
22 
23 #include "SHA3.h"
-
24 
-
37 SHA3_256::SHA3_256()
-
38 {
-
39  core.setCapacity(512);
-
40 }
-
41 
-
45 SHA3_256::~SHA3_256()
-
46 {
-
47  // The destructor for the KeccakCore object will do most of the work.
-
48 }
-
49 
-
50 size_t SHA3_256::hashSize() const
-
51 {
-
52  return 32;
-
53 }
-
54 
-
55 size_t SHA3_256::blockSize() const
-
56 {
-
57  return core.blockSize();
-
58 }
-
59 
-
60 void SHA3_256::reset()
-
61 {
-
62  core.reset();
-
63 }
-
64 
-
65 void SHA3_256::update(const void *data, size_t len)
-
66 {
-
67  core.update(data, len);
-
68 }
-
69 
-
70 void SHA3_256::finalize(void *hash, size_t len)
-
71 {
-
72  // Pad the final block and then extract the hash value.
-
73  core.pad(0x06);
-
74  core.extract(hash, len);
-
75 }
-
76 
-
77 void SHA3_256::clear()
-
78 {
-
79  core.clear();
-
80 }
-
81 
-
94 SHA3_512::SHA3_512()
-
95 {
-
96  core.setCapacity(1024);
-
97 }
-
98 
-
102 SHA3_512::~SHA3_512()
-
103 {
-
104  // The destructor for the KeccakCore object will do most of the work.
-
105 }
-
106 
-
107 size_t SHA3_512::hashSize() const
-
108 {
-
109  return 64;
-
110 }
-
111 
-
112 size_t SHA3_512::blockSize() const
-
113 {
-
114  return core.blockSize();
-
115 }
-
116 
-
117 void SHA3_512::reset()
-
118 {
-
119  core.reset();
-
120 }
-
121 
-
122 void SHA3_512::update(const void *data, size_t len)
-
123 {
-
124  core.update(data, len);
-
125 }
-
126 
-
127 void SHA3_512::finalize(void *hash, size_t len)
-
128 {
-
129  // Pad the final block and then extract the hash value.
-
130  core.pad(0x06);
-
131  core.extract(hash, len);
-
132 }
-
133 
-
134 void SHA3_512::clear()
-
135 {
-
136  core.clear();
-
137 }
-
SHA3_512::SHA3_512
SHA3_512()
Constructs a new SHA3-512 hash object.
Definition: SHA3.cpp:94
-
SHA3_256::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:60
+
24 #include "Crypto.h"
+
25 
+
38 SHA3_256::SHA3_256()
+
39 {
+
40  core.setCapacity(512);
+
41 }
+
42 
+
46 SHA3_256::~SHA3_256()
+
47 {
+
48  // The destructor for the KeccakCore object will do most of the work.
+
49 }
+
50 
+
51 size_t SHA3_256::hashSize() const
+
52 {
+
53  return 32;
+
54 }
+
55 
+
56 size_t SHA3_256::blockSize() const
+
57 {
+
58  return core.blockSize();
+
59 }
+
60 
+
61 void SHA3_256::reset()
+
62 {
+
63  core.reset();
+
64 }
+
65 
+
66 void SHA3_256::update(const void *data, size_t len)
+
67 {
+
68  core.update(data, len);
+
69 }
+
70 
+
71 void SHA3_256::finalize(void *hash, size_t len)
+
72 {
+
73  // Pad the final block and then extract the hash value.
+
74  core.pad(0x06);
+
75  core.extract(hash, len);
+
76 }
+
77 
+
78 void SHA3_256::clear()
+
79 {
+
80  core.clear();
+
81 }
+
82 
+
83 void SHA3_256::resetHMAC(const void *key, size_t keyLen)
+
84 {
+
85  core.setHMACKey(key, keyLen, 0x36, 32);
+
86 }
+
87 
+
88 void SHA3_256::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
89 {
+
90  uint8_t temp[32];
+
91  finalize(temp, sizeof(temp));
+
92  core.setHMACKey(key, keyLen, 0x5C, 32);
+
93  core.update(temp, sizeof(temp));
+
94  finalize(hash, hashLen);
+
95  clean(temp);
+
96 }
+
97 
+
110 SHA3_512::SHA3_512()
+
111 {
+
112  core.setCapacity(1024);
+
113 }
+
114 
+
118 SHA3_512::~SHA3_512()
+
119 {
+
120  // The destructor for the KeccakCore object will do most of the work.
+
121 }
+
122 
+
123 size_t SHA3_512::hashSize() const
+
124 {
+
125  return 64;
+
126 }
+
127 
+
128 size_t SHA3_512::blockSize() const
+
129 {
+
130  return core.blockSize();
+
131 }
+
132 
+
133 void SHA3_512::reset()
+
134 {
+
135  core.reset();
+
136 }
+
137 
+
138 void SHA3_512::update(const void *data, size_t len)
+
139 {
+
140  core.update(data, len);
+
141 }
+
142 
+
143 void SHA3_512::finalize(void *hash, size_t len)
+
144 {
+
145  // Pad the final block and then extract the hash value.
+
146  core.pad(0x06);
+
147  core.extract(hash, len);
+
148 }
+
149 
+
150 void SHA3_512::clear()
+
151 {
+
152  core.clear();
+
153 }
+
154 
+
155 void SHA3_512::resetHMAC(const void *key, size_t keyLen)
+
156 {
+
157  core.setHMACKey(key, keyLen, 0x36, 64);
+
158 }
+
159 
+
160 void SHA3_512::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
161 {
+
162  uint8_t temp[64];
+
163  finalize(temp, sizeof(temp));
+
164  core.setHMACKey(key, keyLen, 0x5C, 64);
+
165  core.update(temp, sizeof(temp));
+
166  finalize(hash, hashLen);
+
167  clean(temp);
+
168 }
+
SHA3_512::SHA3_512
SHA3_512()
Constructs a new SHA3-512 hash object.
Definition: SHA3.cpp:110
+
SHA3_256::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:61
KeccakCore::blockSize
size_t blockSize() const
Returns the input block size for the sponge function in bytes.
Definition: KeccakCore.h:38
-
SHA3_256::~SHA3_256
virtual ~SHA3_256()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:45
-
SHA3_512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:107
-
SHA3_256::SHA3_256
SHA3_256()
Constructs a new SHA3-256 hash object.
Definition: SHA3.cpp:37
-
SHA3_512::~SHA3_512
virtual ~SHA3_512()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:102
-
SHA3_256::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:50
-
SHA3_512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:127
-
SHA3_512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:117
+
SHA3_256::~SHA3_256
virtual ~SHA3_256()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:46
+
SHA3_256::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA3.cpp:83
+
SHA3_512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:123
+
KeccakCore::setHMACKey
void setHMACKey(const void *key, size_t len, uint8_t pad, size_t hashSize)
Sets a HMAC key for a Keccak-based hash algorithm.
Definition: KeccakCore.cpp:263
+
SHA3_256::SHA3_256
SHA3_256()
Constructs a new SHA3-256 hash object.
Definition: SHA3.cpp:38
+
SHA3_256::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA3.cpp:88
+
SHA3_512::~SHA3_512
virtual ~SHA3_512()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:118
+
SHA3_256::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:51
+
SHA3_512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:143
+
SHA3_512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:133
KeccakCore::setCapacity
void setCapacity(size_t capacity)
Sets the capacity of the Keccak sponge function in bits.
Definition: KeccakCore.cpp:89
-
SHA3_256::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:55
+
SHA3_512::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA3.cpp:160
+
SHA3_256::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:56
KeccakCore::extract
void extract(void *data, size_t size)
Extracts data from the Keccak sponge function.
Definition: KeccakCore.cpp:201
-
SHA3_512::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:134
+
SHA3_512::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA3.cpp:155
+
SHA3_512::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:150
KeccakCore::pad
void pad(uint8_t tag)
Pads the last block of input data to blockSize().
Definition: KeccakCore.cpp:174
-
SHA3_512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:112
-
SHA3_512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:122
+
SHA3_512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:128
+
SHA3_512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:138
KeccakCore::update
void update(const void *data, size_t size)
Updates the Keccak sponge function with more input data.
Definition: KeccakCore.cpp:128
KeccakCore::clear
void clear()
Clears all sensitive data from this object.
Definition: KeccakCore.cpp:245
-
SHA3_256::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:70
+
SHA3_256::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:71
KeccakCore::reset
void reset()
Resets the Keccak sponge function ready for a new session.
Definition: KeccakCore.cpp:109
-
SHA3_256::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:65
-
SHA3_256::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:77
+
SHA3_256::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:66
+
SHA3_256::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:78
diff --git a/SHA3_8h_source.html b/SHA3_8h_source.html index 24b7fc1d..d8481f22 100644 --- a/SHA3_8h_source.html +++ b/SHA3_8h_source.html @@ -131,54 +131,64 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
41 
42  void clear();
43 
-
44 private:
-
45  KeccakCore core;
-
46 };
-
47 
-
48 class SHA3_512 : public Hash
-
49 {
-
50 public:
-
51  SHA3_512();
-
52  virtual ~SHA3_512();
-
53 
-
54  size_t hashSize() const;
-
55  size_t blockSize() const;
+
44  void resetHMAC(const void *key, size_t keyLen);
+
45  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
46 
+
47 private:
+
48  KeccakCore core;
+
49 };
+
50 
+
51 class SHA3_512 : public Hash
+
52 {
+
53 public:
+
54  SHA3_512();
+
55  virtual ~SHA3_512();
56 
-
57  void reset();
-
58  void update(const void *data, size_t len);
-
59  void finalize(void *hash, size_t len);
-
60 
-
61  void clear();
-
62 
-
63 private:
-
64  KeccakCore core;
-
65 };
-
66 
-
67 #endif
-
SHA3_512::SHA3_512
SHA3_512()
Constructs a new SHA3-512 hash object.
Definition: SHA3.cpp:94
-
SHA3_256::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:60
-
SHA3_256::~SHA3_256
virtual ~SHA3_256()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:45
-
SHA3_512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:107
-
SHA3_256::SHA3_256
SHA3_256()
Constructs a new SHA3-256 hash object.
Definition: SHA3.cpp:37
-
SHA3_512::~SHA3_512
virtual ~SHA3_512()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:102
+
57  size_t hashSize() const;
+
58  size_t blockSize() const;
+
59 
+
60  void reset();
+
61  void update(const void *data, size_t len);
+
62  void finalize(void *hash, size_t len);
+
63 
+
64  void clear();
+
65 
+
66  void resetHMAC(const void *key, size_t keyLen);
+
67  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
68 
+
69 private:
+
70  KeccakCore core;
+
71 };
+
72 
+
73 #endif
+
SHA3_512::SHA3_512
SHA3_512()
Constructs a new SHA3-512 hash object.
Definition: SHA3.cpp:110
+
SHA3_256::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:61
+
SHA3_256::~SHA3_256
virtual ~SHA3_256()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:46
+
SHA3_256::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA3.cpp:83
+
SHA3_512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:123
+
SHA3_256::SHA3_256
SHA3_256()
Constructs a new SHA3-256 hash object.
Definition: SHA3.cpp:38
+
SHA3_256::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA3.cpp:88
+
SHA3_512::~SHA3_512
virtual ~SHA3_512()
Destroys this hash object after clearing sensitive information.
Definition: SHA3.cpp:118
Hash
Abstract base class for cryptographic hash algorithms.
Definition: Hash.h:29
-
SHA3_256::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:50
-
SHA3_512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:127
-
SHA3_512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:117
-
SHA3_256::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:55
-
SHA3_512::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:134
-
SHA3_512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:112
-
SHA3_512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:122
-
SHA3_256::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:70
+
SHA3_256::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA3.cpp:51
+
SHA3_512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:143
+
SHA3_512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA3.cpp:133
+
SHA3_512::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA3.cpp:160
+
SHA3_256::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:56
+
SHA3_512::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA3.cpp:155
+
SHA3_512::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:150
+
SHA3_512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA3.cpp:128
+
SHA3_512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:138
+
SHA3_256::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA3.cpp:71
KeccakCore
Keccak core sponge function.
Definition: KeccakCore.h:29
SHA3_256
SHA3-256 hash algorithm.
Definition: SHA3.h:29
-
SHA3_512
SHA3-512 hash algorithm.
Definition: SHA3.h:48
-
SHA3_256::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:65
-
SHA3_256::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:77
+
SHA3_512
SHA3-512 hash algorithm.
Definition: SHA3.h:51
+
SHA3_256::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA3.cpp:66
+
SHA3_256::clear
void clear()
Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing ...
Definition: SHA3.cpp:78
diff --git a/SHA512_8cpp_source.html b/SHA512_8cpp_source.html index ed0f2f9c..d3e17589 100644 --- a/SHA512_8cpp_source.html +++ b/SHA512_8cpp_source.html @@ -213,115 +213,134 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
139  reset();
140 }
141 
-
147 void SHA512::processChunk()
-
148 {
-
149  // Round constants for SHA-512.
-
150  static uint64_t const k[80] PROGMEM = {
-
151  0x428A2F98D728AE22ULL, 0x7137449123EF65CDULL, 0xB5C0FBCFEC4D3B2FULL,
-
152  0xE9B5DBA58189DBBCULL, 0x3956C25BF348B538ULL, 0x59F111F1B605D019ULL,
-
153  0x923F82A4AF194F9BULL, 0xAB1C5ED5DA6D8118ULL, 0xD807AA98A3030242ULL,
-
154  0x12835B0145706FBEULL, 0x243185BE4EE4B28CULL, 0x550C7DC3D5FFB4E2ULL,
-
155  0x72BE5D74F27B896FULL, 0x80DEB1FE3B1696B1ULL, 0x9BDC06A725C71235ULL,
-
156  0xC19BF174CF692694ULL, 0xE49B69C19EF14AD2ULL, 0xEFBE4786384F25E3ULL,
-
157  0x0FC19DC68B8CD5B5ULL, 0x240CA1CC77AC9C65ULL, 0x2DE92C6F592B0275ULL,
-
158  0x4A7484AA6EA6E483ULL, 0x5CB0A9DCBD41FBD4ULL, 0x76F988DA831153B5ULL,
-
159  0x983E5152EE66DFABULL, 0xA831C66D2DB43210ULL, 0xB00327C898FB213FULL,
-
160  0xBF597FC7BEEF0EE4ULL, 0xC6E00BF33DA88FC2ULL, 0xD5A79147930AA725ULL,
-
161  0x06CA6351E003826FULL, 0x142929670A0E6E70ULL, 0x27B70A8546D22FFCULL,
-
162  0x2E1B21385C26C926ULL, 0x4D2C6DFC5AC42AEDULL, 0x53380D139D95B3DFULL,
-
163  0x650A73548BAF63DEULL, 0x766A0ABB3C77B2A8ULL, 0x81C2C92E47EDAEE6ULL,
-
164  0x92722C851482353BULL, 0xA2BFE8A14CF10364ULL, 0xA81A664BBC423001ULL,
-
165  0xC24B8B70D0F89791ULL, 0xC76C51A30654BE30ULL, 0xD192E819D6EF5218ULL,
-
166  0xD69906245565A910ULL, 0xF40E35855771202AULL, 0x106AA07032BBD1B8ULL,
-
167  0x19A4C116B8D2D0C8ULL, 0x1E376C085141AB53ULL, 0x2748774CDF8EEB99ULL,
-
168  0x34B0BCB5E19B48A8ULL, 0x391C0CB3C5C95A63ULL, 0x4ED8AA4AE3418ACBULL,
-
169  0x5B9CCA4F7763E373ULL, 0x682E6FF3D6B2B8A3ULL, 0x748F82EE5DEFB2FCULL,
-
170  0x78A5636F43172F60ULL, 0x84C87814A1F0AB72ULL, 0x8CC702081A6439ECULL,
-
171  0x90BEFFFA23631E28ULL, 0xA4506CEBDE82BDE9ULL, 0xBEF9A3F7B2C67915ULL,
-
172  0xC67178F2E372532BULL, 0xCA273ECEEA26619CULL, 0xD186B8C721C0C207ULL,
-
173  0xEADA7DD6CDE0EB1EULL, 0xF57D4F7FEE6ED178ULL, 0x06F067AA72176FBAULL,
-
174  0x0A637DC5A2C898A6ULL, 0x113F9804BEF90DAEULL, 0x1B710B35131C471BULL,
-
175  0x28DB77F523047D84ULL, 0x32CAAB7B40C72493ULL, 0x3C9EBE0A15C9BEBCULL,
-
176  0x431D67C49C100D4CULL, 0x4CC5D4BECB3E42B6ULL, 0x597F299CFC657E2AULL,
-
177  0x5FCB6FAB3AD6FAECULL, 0x6C44198C4A475817ULL
-
178  };
-
179 
-
180  // Convert the first 16 words from big endian to host byte order.
-
181  uint8_t index;
-
182  for (index = 0; index < 16; ++index)
-
183  state.w[index] = be64toh(state.w[index]);
-
184 
-
185  // Initialise working variables to the current hash value.
-
186  uint64_t a = state.h[0];
-
187  uint64_t b = state.h[1];
-
188  uint64_t c = state.h[2];
-
189  uint64_t d = state.h[3];
-
190  uint64_t e = state.h[4];
-
191  uint64_t f = state.h[5];
-
192  uint64_t g = state.h[6];
-
193  uint64_t h = state.h[7];
-
194 
-
195  // Perform the first 16 rounds of the compression function main loop.
-
196  uint64_t temp1, temp2;
-
197  for (index = 0; index < 16; ++index) {
-
198  temp1 = h + pgm_read_qword(k + index) + state.w[index] +
-
199  (rightRotate14_64(e) ^ rightRotate18_64(e) ^
-
200  rightRotate41_64(e)) + ((e & f) ^ ((~e) & g));
-
201  temp2 = (rightRotate28_64(a) ^ rightRotate34_64(a) ^
-
202  rightRotate39_64(a)) + ((a & b) ^ (a & c) ^ (b & c));
-
203  h = g;
-
204  g = f;
-
205  f = e;
-
206  e = d + temp1;
-
207  d = c;
-
208  c = b;
-
209  b = a;
-
210  a = temp1 + temp2;
-
211  }
-
212 
-
213  // Perform the 64 remaining rounds. We expand the first 16 words to
-
214  // 80 in-place in the "w" array. This saves 512 bytes of memory
-
215  // that would have otherwise need to be allocated to the "w" array.
-
216  for (; index < 80; ++index) {
-
217  // Expand the next word.
-
218  temp1 = state.w[(index - 15) & 0x0F];
-
219  temp2 = state.w[(index - 2) & 0x0F];
-
220  temp1 = state.w[index & 0x0F] =
-
221  state.w[(index - 16) & 0x0F] + state.w[(index - 7) & 0x0F] +
-
222  (rightRotate1_64(temp1) ^ rightRotate8_64(temp1) ^
-
223  (temp1 >> 7)) +
-
224  (rightRotate19_64(temp2) ^ rightRotate61_64(temp2) ^
-
225  (temp2 >> 6));
-
226 
-
227  // Perform the round.
-
228  temp1 = h + pgm_read_qword(k + index) + temp1 +
-
229  (rightRotate14_64(e) ^ rightRotate18_64(e) ^
-
230  rightRotate41_64(e)) + ((e & f) ^ ((~e) & g));
-
231  temp2 = (rightRotate28_64(a) ^ rightRotate34_64(a) ^
-
232  rightRotate39_64(a)) + ((a & b) ^ (a & c) ^ (b & c));
-
233  h = g;
-
234  g = f;
-
235  f = e;
-
236  e = d + temp1;
-
237  d = c;
-
238  c = b;
-
239  b = a;
-
240  a = temp1 + temp2;
-
241  }
-
242 
-
243  // Add the compressed chunk to the current hash value.
-
244  state.h[0] += a;
-
245  state.h[1] += b;
-
246  state.h[2] += c;
-
247  state.h[3] += d;
-
248  state.h[4] += e;
-
249  state.h[5] += f;
-
250  state.h[6] += g;
-
251  state.h[7] += h;
-
252 
-
253  // Attempt to clean up the stack.
-
254  a = b = c = d = e = f = g = h = temp1 = temp2 = 0;
-
255 }
+
142 void SHA512::resetHMAC(const void *key, size_t keyLen)
+
143 {
+
144  formatHMACKey(state.w, key, keyLen, 0x36);
+
145  state.lengthLow += 128 * 8;
+
146  processChunk();
+
147 }
+
148 
+
149 void SHA512::finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
+
150 {
+
151  uint8_t temp[64];
+
152  finalize(temp, sizeof(temp));
+
153  formatHMACKey(state.w, key, keyLen, 0x5C);
+
154  state.lengthLow += 128 * 8;
+
155  processChunk();
+
156  update(temp, sizeof(temp));
+
157  finalize(hash, hashLen);
+
158  clean(temp);
+
159 }
+
160 
+
166 void SHA512::processChunk()
+
167 {
+
168  // Round constants for SHA-512.
+
169  static uint64_t const k[80] PROGMEM = {
+
170  0x428A2F98D728AE22ULL, 0x7137449123EF65CDULL, 0xB5C0FBCFEC4D3B2FULL,
+
171  0xE9B5DBA58189DBBCULL, 0x3956C25BF348B538ULL, 0x59F111F1B605D019ULL,
+
172  0x923F82A4AF194F9BULL, 0xAB1C5ED5DA6D8118ULL, 0xD807AA98A3030242ULL,
+
173  0x12835B0145706FBEULL, 0x243185BE4EE4B28CULL, 0x550C7DC3D5FFB4E2ULL,
+
174  0x72BE5D74F27B896FULL, 0x80DEB1FE3B1696B1ULL, 0x9BDC06A725C71235ULL,
+
175  0xC19BF174CF692694ULL, 0xE49B69C19EF14AD2ULL, 0xEFBE4786384F25E3ULL,
+
176  0x0FC19DC68B8CD5B5ULL, 0x240CA1CC77AC9C65ULL, 0x2DE92C6F592B0275ULL,
+
177  0x4A7484AA6EA6E483ULL, 0x5CB0A9DCBD41FBD4ULL, 0x76F988DA831153B5ULL,
+
178  0x983E5152EE66DFABULL, 0xA831C66D2DB43210ULL, 0xB00327C898FB213FULL,
+
179  0xBF597FC7BEEF0EE4ULL, 0xC6E00BF33DA88FC2ULL, 0xD5A79147930AA725ULL,
+
180  0x06CA6351E003826FULL, 0x142929670A0E6E70ULL, 0x27B70A8546D22FFCULL,
+
181  0x2E1B21385C26C926ULL, 0x4D2C6DFC5AC42AEDULL, 0x53380D139D95B3DFULL,
+
182  0x650A73548BAF63DEULL, 0x766A0ABB3C77B2A8ULL, 0x81C2C92E47EDAEE6ULL,
+
183  0x92722C851482353BULL, 0xA2BFE8A14CF10364ULL, 0xA81A664BBC423001ULL,
+
184  0xC24B8B70D0F89791ULL, 0xC76C51A30654BE30ULL, 0xD192E819D6EF5218ULL,
+
185  0xD69906245565A910ULL, 0xF40E35855771202AULL, 0x106AA07032BBD1B8ULL,
+
186  0x19A4C116B8D2D0C8ULL, 0x1E376C085141AB53ULL, 0x2748774CDF8EEB99ULL,
+
187  0x34B0BCB5E19B48A8ULL, 0x391C0CB3C5C95A63ULL, 0x4ED8AA4AE3418ACBULL,
+
188  0x5B9CCA4F7763E373ULL, 0x682E6FF3D6B2B8A3ULL, 0x748F82EE5DEFB2FCULL,
+
189  0x78A5636F43172F60ULL, 0x84C87814A1F0AB72ULL, 0x8CC702081A6439ECULL,
+
190  0x90BEFFFA23631E28ULL, 0xA4506CEBDE82BDE9ULL, 0xBEF9A3F7B2C67915ULL,
+
191  0xC67178F2E372532BULL, 0xCA273ECEEA26619CULL, 0xD186B8C721C0C207ULL,
+
192  0xEADA7DD6CDE0EB1EULL, 0xF57D4F7FEE6ED178ULL, 0x06F067AA72176FBAULL,
+
193  0x0A637DC5A2C898A6ULL, 0x113F9804BEF90DAEULL, 0x1B710B35131C471BULL,
+
194  0x28DB77F523047D84ULL, 0x32CAAB7B40C72493ULL, 0x3C9EBE0A15C9BEBCULL,
+
195  0x431D67C49C100D4CULL, 0x4CC5D4BECB3E42B6ULL, 0x597F299CFC657E2AULL,
+
196  0x5FCB6FAB3AD6FAECULL, 0x6C44198C4A475817ULL
+
197  };
+
198 
+
199  // Convert the first 16 words from big endian to host byte order.
+
200  uint8_t index;
+
201  for (index = 0; index < 16; ++index)
+
202  state.w[index] = be64toh(state.w[index]);
+
203 
+
204  // Initialise working variables to the current hash value.
+
205  uint64_t a = state.h[0];
+
206  uint64_t b = state.h[1];
+
207  uint64_t c = state.h[2];
+
208  uint64_t d = state.h[3];
+
209  uint64_t e = state.h[4];
+
210  uint64_t f = state.h[5];
+
211  uint64_t g = state.h[6];
+
212  uint64_t h = state.h[7];
+
213 
+
214  // Perform the first 16 rounds of the compression function main loop.
+
215  uint64_t temp1, temp2;
+
216  for (index = 0; index < 16; ++index) {
+
217  temp1 = h + pgm_read_qword(k + index) + state.w[index] +
+
218  (rightRotate14_64(e) ^ rightRotate18_64(e) ^
+
219  rightRotate41_64(e)) + ((e & f) ^ ((~e) & g));
+
220  temp2 = (rightRotate28_64(a) ^ rightRotate34_64(a) ^
+
221  rightRotate39_64(a)) + ((a & b) ^ (a & c) ^ (b & c));
+
222  h = g;
+
223  g = f;
+
224  f = e;
+
225  e = d + temp1;
+
226  d = c;
+
227  c = b;
+
228  b = a;
+
229  a = temp1 + temp2;
+
230  }
+
231 
+
232  // Perform the 64 remaining rounds. We expand the first 16 words to
+
233  // 80 in-place in the "w" array. This saves 512 bytes of memory
+
234  // that would have otherwise need to be allocated to the "w" array.
+
235  for (; index < 80; ++index) {
+
236  // Expand the next word.
+
237  temp1 = state.w[(index - 15) & 0x0F];
+
238  temp2 = state.w[(index - 2) & 0x0F];
+
239  temp1 = state.w[index & 0x0F] =
+
240  state.w[(index - 16) & 0x0F] + state.w[(index - 7) & 0x0F] +
+
241  (rightRotate1_64(temp1) ^ rightRotate8_64(temp1) ^
+
242  (temp1 >> 7)) +
+
243  (rightRotate19_64(temp2) ^ rightRotate61_64(temp2) ^
+
244  (temp2 >> 6));
+
245 
+
246  // Perform the round.
+
247  temp1 = h + pgm_read_qword(k + index) + temp1 +
+
248  (rightRotate14_64(e) ^ rightRotate18_64(e) ^
+
249  rightRotate41_64(e)) + ((e & f) ^ ((~e) & g));
+
250  temp2 = (rightRotate28_64(a) ^ rightRotate34_64(a) ^
+
251  rightRotate39_64(a)) + ((a & b) ^ (a & c) ^ (b & c));
+
252  h = g;
+
253  g = f;
+
254  f = e;
+
255  e = d + temp1;
+
256  d = c;
+
257  c = b;
+
258  b = a;
+
259  a = temp1 + temp2;
+
260  }
+
261 
+
262  // Add the compressed chunk to the current hash value.
+
263  state.h[0] += a;
+
264  state.h[1] += b;
+
265  state.h[2] += c;
+
266  state.h[3] += d;
+
267  state.h[4] += e;
+
268  state.h[5] += f;
+
269  state.h[6] += g;
+
270  state.h[7] += h;
+
271 
+
272  // Attempt to clean up the stack.
+
273  a = b = c = d = e = f = g = h = temp1 = temp2 = 0;
+
274 }
SHA512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA512.cpp:56
SHA512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA512.cpp:61
SHA512::~SHA512
virtual ~SHA512()
Destroys this SHA-512 hash object after clearing sensitive information.
Definition: SHA512.cpp:51
@@ -329,11 +348,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SHA512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA512.cpp:66
SHA512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA512.cpp:79
SHA512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA512.cpp:105
+
SHA512::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA512.cpp:149
SHA512::SHA512
SHA512()
Constructs a SHA-512 hash object.
Definition: SHA512.cpp:42
+
Hash::formatHMACKey
void formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)
Formats a HMAC key into a block.
Definition: Hash.cpp:162
+
SHA512::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA512.cpp:142
diff --git a/SHA512_8h_source.html b/SHA512_8h_source.html index 57107f09..53b5d193 100644 --- a/SHA512_8h_source.html +++ b/SHA512_8h_source.html @@ -130,19 +130,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
40 
41  void clear();
42 
-
43 private:
-
44  struct {
-
45  uint64_t h[8];
-
46  uint64_t w[16];
-
47  uint64_t lengthLow;
-
48  uint64_t lengthHigh;
-
49  uint8_t chunkSize;
-
50  } state;
-
51 
-
52  void processChunk();
-
53 };
+
43  void resetHMAC(const void *key, size_t keyLen);
+
44  void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen);
+
45 
+
46 private:
+
47  struct {
+
48  uint64_t h[8];
+
49  uint64_t w[16];
+
50  uint64_t lengthLow;
+
51  uint64_t lengthHigh;
+
52  uint8_t chunkSize;
+
53  } state;
54 
-
55 #endif
+
55  void processChunk();
+
56 };
+
57 
+
58 #endif
SHA512::hashSize
size_t hashSize() const
Size of the hash result from finalize().
Definition: SHA512.cpp:56
SHA512::blockSize
size_t blockSize() const
Size of the internal block used by the hash algorithm.
Definition: SHA512.cpp:61
SHA512::~SHA512
virtual ~SHA512()
Destroys this SHA-512 hash object after clearing sensitive information.
Definition: SHA512.cpp:51
@@ -152,11 +155,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SHA512::reset
void reset()
Resets the hash ready for a new hashing process.
Definition: SHA512.cpp:66
SHA512::update
void update(const void *data, size_t len)
Updates the hash with more data.
Definition: SHA512.cpp:79
SHA512::finalize
void finalize(void *hash, size_t len)
Finalizes the hashing process and returns the hash.
Definition: SHA512.cpp:105
+
SHA512::finalizeHMAC
void finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)
Finalizes the HMAC hashing process and returns the hash.
Definition: SHA512.cpp:149
SHA512::SHA512
SHA512()
Constructs a SHA-512 hash object.
Definition: SHA512.cpp:42
+
SHA512::resetHMAC
void resetHMAC(const void *key, size_t keyLen)
Resets the hash ready for a new HMAC hashing process.
Definition: SHA512.cpp:142
diff --git a/SoftI2C_8cpp_source.html b/SoftI2C_8cpp_source.html index 59bf1d6c..5d45ca7a 100644 --- a/SoftI2C_8cpp_source.html +++ b/SoftI2C_8cpp_source.html @@ -283,7 +283,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SoftI2C_8h_source.html b/SoftI2C_8h_source.html index 9a7cd4ca..b0126c95 100644 --- a/SoftI2C_8h_source.html +++ b/SoftI2C_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TextField_8cpp_source.html b/TextField_8cpp_source.html index 5144db5f..5809e0ea 100644 --- a/TextField_8cpp_source.html +++ b/TextField_8cpp_source.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TextField_8h_source.html b/TextField_8h_source.html index ee9c4780..07839b95 100644 --- a/TextField_8h_source.html +++ b/TextField_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TimeField_8cpp_source.html b/TimeField_8cpp_source.html index ceb23aef..8ab72da1 100644 --- a/TimeField_8cpp_source.html +++ b/TimeField_8cpp_source.html @@ -325,7 +325,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TimeField_8h_source.html b/TimeField_8h_source.html index 7f764528..3f783b22 100644 --- a/TimeField_8h_source.html +++ b/TimeField_8h_source.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TransistorNoiseSource_8cpp_source.html b/TransistorNoiseSource_8cpp_source.html index 56341e29..3cbe1dae 100644 --- a/TransistorNoiseSource_8cpp_source.html +++ b/TransistorNoiseSource_8cpp_source.html @@ -295,7 +295,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TransistorNoiseSource_8h_source.html b/TransistorNoiseSource_8h_source.html index 7b358ed4..66b2e040 100644 --- a/TransistorNoiseSource_8h_source.html +++ b/TransistorNoiseSource_8h_source.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/alarm-clock_8dox.html b/alarm-clock_8dox.html index 40cd8027..474d9c12 100644 --- a/alarm-clock_8dox.html +++ b/alarm-clock_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/alarm_clock.html b/alarm_clock.html index 907f730b..3821e616 100644 --- a/alarm_clock.html +++ b/alarm_clock.html @@ -140,7 +140,7 @@ Completed Clock diff --git a/annotated.html b/annotated.html index f5d30b37..e840d0a8 100644 --- a/annotated.html +++ b/annotated.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-blink_8dox.html b/blink-blink_8dox.html index 6c2519f6..57305e12 100644 --- a/blink-blink_8dox.html +++ b/blink-blink_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-charlieplex_8dox.html b/blink-charlieplex_8dox.html index 4d1b66d4..178da258 100644 --- a/blink-charlieplex_8dox.html +++ b/blink-charlieplex_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-cylon_8dox.html b/blink-cylon_8dox.html index 55149c5e..9e51c4e6 100644 --- a/blink-cylon_8dox.html +++ b/blink-cylon_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-startrek_8dox.html b/blink-startrek_8dox.html index 3f923899..cb361d38 100644 --- a/blink-startrek_8dox.html +++ b/blink-startrek_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_blink.html b/blink_blink.html index 3ac79dda..1f34e68a 100644 --- a/blink_blink.html +++ b/blink_blink.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_charlieplex.html b/blink_charlieplex.html index 0fa687f6..061b64bc 100644 --- a/blink_charlieplex.html +++ b/blink_charlieplex.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_cylon.html b/blink_cylon.html index ea1ad046..abf8e880 100644 --- a/blink_cylon.html +++ b/blink_cylon.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_startrek.html b/blink_startrek.html index 68a980e6..22e9f080 100644 --- a/blink_startrek.html +++ b/blink_startrek.html @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES128-members.html b/classAES128-members.html index 0992a4a9..722b0920 100644 --- a/classAES128-members.html +++ b/classAES128-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES128.html b/classAES128.html index a4a736da..edf00c6c 100644 --- a/classAES128.html +++ b/classAES128.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAES192-members.html b/classAES192-members.html index be8b6457..2003b2ab 100644 --- a/classAES192-members.html +++ b/classAES192-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES192.html b/classAES192.html index f41bcd17..019f1deb 100644 --- a/classAES192.html +++ b/classAES192.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAES256-members.html b/classAES256-members.html index 644dcdc2..7177e2a7 100644 --- a/classAES256-members.html +++ b/classAES256-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES256.html b/classAES256.html index 9e26bdac..1d151ed1 100644 --- a/classAES256.html +++ b/classAES256.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAESCommon-members.html b/classAESCommon-members.html index 6f0574e9..d9fe7b54 100644 --- a/classAESCommon-members.html +++ b/classAESCommon-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAESCommon.html b/classAESCommon.html index 9676b4f6..a0d5a06e 100644 --- a/classAESCommon.html +++ b/classAESCommon.html @@ -322,7 +322,7 @@ Protected Member Functions diff --git a/classBLAKE2b-members.html b/classBLAKE2b-members.html index 5e4c06a5..a0e3eca2 100644 --- a/classBLAKE2b-members.html +++ b/classBLAKE2b-members.html @@ -95,6 +95,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); chunkSize (defined in BLAKE2b)BLAKE2b clear()BLAKE2bvirtual finalize(void *hash, size_t len)BLAKE2bvirtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)BLAKE2bvirtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected h (defined in BLAKE2b)BLAKE2b Hash()Hash hashSize() const BLAKE2bvirtual @@ -103,14 +105,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); m (defined in BLAKE2b)BLAKE2b reset()BLAKE2bvirtual reset(uint8_t outputLength)BLAKE2b - update(const void *data, size_t len)BLAKE2bvirtual - v (defined in BLAKE2b)BLAKE2b - ~BLAKE2b()BLAKE2bvirtual - ~Hash()Hashvirtual + resetHMAC(const void *key, size_t keyLen)BLAKE2bvirtual + update(const void *data, size_t len)BLAKE2bvirtual + v (defined in BLAKE2b)BLAKE2b + ~BLAKE2b()BLAKE2bvirtual + ~Hash()Hashvirtual diff --git a/classBLAKE2b.html b/classBLAKE2b.html index 3db6be26..957b2dfd 100644 --- a/classBLAKE2b.html +++ b/classBLAKE2b.html @@ -136,6 +136,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -144,6 +150,13 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

BLAKE2b hash algorithm.

@@ -255,12 +268,74 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

Definition at line 143 of file BLAKE2b.cpp.

+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void BLAKE2b::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 172 of file BLAKE2b.cpp.

+
@@ -315,7 +390,7 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

@@ -347,6 +422,62 @@ virtual 103 of file BLAKE2b.cpp.

+ + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void BLAKE2b::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 165 of file BLAKE2b.cpp.

+
@@ -405,7 +536,7 @@ virtual  diff --git a/classBLAKE2s-members.html b/classBLAKE2s-members.html index cbdb4e75..bb0a4d1e 100644 --- a/classBLAKE2s-members.html +++ b/classBLAKE2s-members.html @@ -95,6 +95,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); chunkSize (defined in BLAKE2s)BLAKE2s clear()BLAKE2svirtual finalize(void *hash, size_t len)BLAKE2svirtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)BLAKE2svirtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected h (defined in BLAKE2s)BLAKE2s Hash()Hash hashSize() const BLAKE2svirtual @@ -102,14 +104,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); m (defined in BLAKE2s)BLAKE2s reset()BLAKE2svirtual reset(uint8_t outputLength)BLAKE2s - update(const void *data, size_t len)BLAKE2svirtual - v (defined in BLAKE2s)BLAKE2s - ~BLAKE2s()BLAKE2svirtual - ~Hash()Hashvirtual + resetHMAC(const void *key, size_t keyLen)BLAKE2svirtual + update(const void *data, size_t len)BLAKE2svirtual + v (defined in BLAKE2s)BLAKE2s + ~BLAKE2s()BLAKE2svirtual + ~Hash()Hashvirtual diff --git a/classBLAKE2s.html b/classBLAKE2s.html index 0d908666..388ee088 100644 --- a/classBLAKE2s.html +++ b/classBLAKE2s.html @@ -136,6 +136,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -144,6 +150,13 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

BLAKE2s hash algorithm.

@@ -255,12 +268,74 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

Definition at line 138 of file BLAKE2s.cpp.

+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void BLAKE2s::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 167 of file BLAKE2s.cpp.

+
@@ -315,7 +390,7 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

@@ -347,6 +422,62 @@ virtual 102 of file BLAKE2s.cpp.

+ + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void BLAKE2s::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 160 of file BLAKE2s.cpp.

+
@@ -405,7 +536,7 @@ virtual  diff --git a/classBitmap-members.html b/classBitmap-members.html index 7b76af7b..b4d742d2 100644 --- a/classBitmap-members.html +++ b/classBitmap-members.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBitmap.html b/classBitmap.html index 4ba30530..7c90b354 100644 --- a/classBitmap.html +++ b/classBitmap.html @@ -1745,7 +1745,7 @@ class DMD diff --git a/classBlinkLED-members.html b/classBlinkLED-members.html index f3392b5f..966da8db 100644 --- a/classBlinkLED-members.html +++ b/classBlinkLED-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBlinkLED.html b/classBlinkLED.html index 4c9c613d..083fd731 100644 --- a/classBlinkLED.html +++ b/classBlinkLED.html @@ -428,7 +428,7 @@ Public Member Functions diff --git a/classBlockCipher-members.html b/classBlockCipher-members.html index 82f9b8ac..cebd3928 100644 --- a/classBlockCipher-members.html +++ b/classBlockCipher-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBlockCipher.html b/classBlockCipher.html index 6f7b208b..01cb79d1 100644 --- a/classBlockCipher.html +++ b/classBlockCipher.html @@ -407,7 +407,7 @@ Public Member Functions diff --git a/classBoolField-members.html b/classBoolField-members.html index 0a1b6e33..a353d00d 100644 --- a/classBoolField-members.html +++ b/classBoolField-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBoolField.html b/classBoolField.html index 969e49e1..28a519a7 100644 --- a/classBoolField.html +++ b/classBoolField.html @@ -506,7 +506,7 @@ LiquidCrystal *  diff --git a/classCBC-members.html b/classCBC-members.html index 4c03814d..14a31eec 100644 --- a/classCBC-members.html +++ b/classCBC-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCBC.html b/classCBC.html index 4ee3d756..85d8f8f1 100644 --- a/classCBC.html +++ b/classCBC.html @@ -185,7 +185,7 @@ class CBC< T > diff --git a/classCBCCommon-members.html b/classCBCCommon-members.html index 899f8178..1d0a0aa6 100644 --- a/classCBCCommon-members.html +++ b/classCBCCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCBCCommon.html b/classCBCCommon.html index 520f1735..4b459712 100644 --- a/classCBCCommon.html +++ b/classCBCCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classCFB-members.html b/classCFB-members.html index b72edd7f..b8cc27d8 100644 --- a/classCFB-members.html +++ b/classCFB-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCFB.html b/classCFB.html index 3f7cf584..6e3f29dd 100644 --- a/classCFB.html +++ b/classCFB.html @@ -185,7 +185,7 @@ class CFB< T > diff --git a/classCFBCommon-members.html b/classCFBCommon-members.html index 5a7268f5..4d35664e 100644 --- a/classCFBCommon-members.html +++ b/classCFBCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCFBCommon.html b/classCFBCommon.html index b421a47a..766e0aea 100644 --- a/classCFBCommon.html +++ b/classCFBCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classCTR-members.html b/classCTR-members.html index ea1b42d6..f19ffd4c 100644 --- a/classCTR-members.html +++ b/classCTR-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCTR.html b/classCTR.html index f222cc5e..f8bf184c 100644 --- a/classCTR.html +++ b/classCTR.html @@ -181,7 +181,7 @@ class CTR< T > diff --git a/classCTRCommon-members.html b/classCTRCommon-members.html index cf778002..4f0ef39e 100644 --- a/classCTRCommon-members.html +++ b/classCTRCommon-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCTRCommon.html b/classCTRCommon.html index 08f5acae..1c916386 100644 --- a/classCTRCommon.html +++ b/classCTRCommon.html @@ -563,7 +563,7 @@ Protected Member Functions diff --git a/classChaCha-members.html b/classChaCha-members.html index fe989c08..f8a3a9bf 100644 --- a/classChaCha-members.html +++ b/classChaCha-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaCha.html b/classChaCha.html index 75525ca6..c4ec074c 100644 --- a/classChaCha.html +++ b/classChaCha.html @@ -666,7 +666,7 @@ Static Public Member Functions diff --git a/classCharlieplex-members.html b/classCharlieplex-members.html index a94f3471..4864f9e5 100644 --- a/classCharlieplex-members.html +++ b/classCharlieplex-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCharlieplex.html b/classCharlieplex.html index 2dc58cc3..9bbf0e93 100644 --- a/classCharlieplex.html +++ b/classCharlieplex.html @@ -538,7 +538,7 @@ Public Member Functions diff --git a/classChaseLEDs-members.html b/classChaseLEDs-members.html index 8a6935f5..51435913 100644 --- a/classChaseLEDs-members.html +++ b/classChaseLEDs-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaseLEDs.html b/classChaseLEDs.html index b9f525e6..825255cf 100644 --- a/classChaseLEDs.html +++ b/classChaseLEDs.html @@ -347,7 +347,7 @@ Protected Member Functions diff --git a/classCipher-members.html b/classCipher-members.html index 0074639f..306a2a93 100644 --- a/classCipher-members.html +++ b/classCipher-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCipher.html b/classCipher.html index e87629c6..b421c028 100644 --- a/classCipher.html +++ b/classCipher.html @@ -479,7 +479,7 @@ Public Member Functions diff --git a/classCurve25519-members.html b/classCurve25519-members.html index 62a9e4fe..11f7f552 100644 --- a/classCurve25519-members.html +++ b/classCurve25519-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCurve25519.html b/classCurve25519.html index de1b79e1..35b3fd2b 100644 --- a/classCurve25519.html +++ b/classCurve25519.html @@ -295,7 +295,7 @@ Static Public Member Functions diff --git a/classDMD-members.html b/classDMD-members.html index 1fe68461..0ee764d4 100644 --- a/classDMD-members.html +++ b/classDMD-members.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDMD.html b/classDMD.html index 850755e9..a9c3daf7 100644 --- a/classDMD.html +++ b/classDMD.html @@ -755,7 +755,7 @@ Multiple panels diff --git a/classDS1307RTC-members.html b/classDS1307RTC-members.html index 9406c334..69a76c9e 100644 --- a/classDS1307RTC-members.html +++ b/classDS1307RTC-members.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS1307RTC.html b/classDS1307RTC.html index 97adc0c2..bd79e380 100644 --- a/classDS1307RTC.html +++ b/classDS1307RTC.html @@ -598,7 +598,7 @@ static const uint8_t  diff --git a/classDS3232RTC-members.html b/classDS3232RTC-members.html index 148c0930..d756c921 100644 --- a/classDS3232RTC-members.html +++ b/classDS3232RTC-members.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS3232RTC.html b/classDS3232RTC.html index 439e3744..910c752d 100644 --- a/classDS3232RTC.html +++ b/classDS3232RTC.html @@ -750,7 +750,7 @@ static const uint8_t  diff --git a/classEEPROM24-members.html b/classEEPROM24-members.html index a0bb0d5e..4318c5c7 100644 --- a/classEEPROM24-members.html +++ b/classEEPROM24-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classEEPROM24.html b/classEEPROM24.html index 5ec3ecbe..5b534945 100644 --- a/classEEPROM24.html +++ b/classEEPROM24.html @@ -431,7 +431,7 @@ Public Member Functions diff --git a/classField-members.html b/classField-members.html index 9e330222..3a704a5f 100644 --- a/classField-members.html +++ b/classField-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classField.html b/classField.html index 55d70000..85f022c2 100644 --- a/classField.html +++ b/classField.html @@ -424,7 +424,7 @@ class Form diff --git a/classForm-members.html b/classForm-members.html index d3fbaa59..e290453d 100644 --- a/classForm-members.html +++ b/classForm-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classForm.html b/classForm.html index 72aad5d8..3eb97d83 100644 --- a/classForm.html +++ b/classForm.html @@ -485,7 +485,7 @@ class Field diff --git a/classHash-members.html b/classHash-members.html index 246205e0..ddfd5532 100644 --- a/classHash-members.html +++ b/classHash-members.html @@ -93,15 +93,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); blockSize() const =0Hashpure virtual clear()=0Hashpure virtual finalize(void *hash, size_t len)=0Hashpure virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)=0Hashpure virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected Hash()Hash hashSize() const =0Hashpure virtual reset()=0Hashpure virtual - update(const void *data, size_t len)=0Hashpure virtual - ~Hash()Hashvirtual + resetHMAC(const void *key, size_t keyLen)=0Hashpure virtual + update(const void *data, size_t len)=0Hashpure virtual + ~Hash()Hashvirtual diff --git a/classHash.html b/classHash.html index 855ec0a4..b2109ceb 100644 --- a/classHash.html +++ b/classHash.html @@ -85,6 +85,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Public Member Functions | +Protected Member Functions | List of all members
Hash Class Referenceabstract
@@ -138,6 +139,18 @@ Public Member Functions virtual void clear ()=0  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +virtual void resetHMAC (const void *key, size_t keyLen)=0 + Resets the hash ready for a new HMAC hashing process. More...
+  +virtual void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen)=0 + Finalizes the HMAC hashing process and returns the hash. More...
+  + + + + +

+Protected Member Functions

void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

Abstract base class for cryptographic hash algorithms.

@@ -170,7 +183,7 @@ Public Member Functions
Note
Subclasses are responsible for clearing any sensitive data that remains in the hash object when it is destroyed.
See Also
clear()
-

Definition at line 47 of file Hash.cpp.

+

Definition at line 48 of file Hash.cpp.

@@ -273,10 +286,130 @@ Public Member Functions

If len is less than hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+ + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void Hash::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+pure virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void Hash::formatHMACKey (void * block,
const void * key,
size_t len,
uint8_t pad 
)
+
+protected
+
+ +

Formats a HMAC key into a block.

+
Parameters
+ + + + + +
blockThe block to format the key into. Must be at least blockSize() bytes in length.
keyPoints to the HMAC key for the hashing process.
lenLength of the HMAC key in bytes.
padInner (0x36) or outer (0x5C) padding value to XOR with the formatted HMAC key.
+
+
+

This function is intended to help subclasses implement resetHMAC() and finalizeHMAC() by directly formatting the HMAC key into the subclass's internal block buffer and resetting the hash.

+ +

Definition at line 162 of file Hash.cpp.

+
@@ -329,10 +462,64 @@ Public Member Functions

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implemented in SHA3_512, SHA3_256, BLAKE2b, BLAKE2s, SHA1, SHA256, and SHA512.

+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void Hash::resetHMAC (const void * key,
size_t keyLen 
)
+
+pure virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implemented in SHA3_512, BLAKE2b, BLAKE2s, SHA3_256, SHA1, SHA256, and SHA512.

+
@@ -389,7 +576,7 @@ Public Member Functions diff --git a/classI2CMaster-members.html b/classI2CMaster-members.html index 5d4919f0..bacc72f9 100644 --- a/classI2CMaster-members.html +++ b/classI2CMaster-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classI2CMaster.html b/classI2CMaster.html index e7e43576..e17424d4 100644 --- a/classI2CMaster.html +++ b/classI2CMaster.html @@ -328,7 +328,7 @@ virtual unsigned int  diff --git a/classIRreceiver-members.html b/classIRreceiver-members.html index 723d3f92..6373d8ae 100644 --- a/classIRreceiver-members.html +++ b/classIRreceiver-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classIRreceiver.html b/classIRreceiver.html index 66f3ac09..7c2ad574 100644 --- a/classIRreceiver.html +++ b/classIRreceiver.html @@ -328,7 +328,7 @@ void _IR_receive_interrupt diff --git a/classIntField-members.html b/classIntField-members.html index ffeb89ba..b64f34c2 100644 --- a/classIntField-members.html +++ b/classIntField-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classIntField.html b/classIntField.html index e873fce3..3a9afe8a 100644 --- a/classIntField.html +++ b/classIntField.html @@ -647,7 +647,7 @@ LiquidCrystal *  diff --git a/classKeccakCore-members.html b/classKeccakCore-members.html index bc6da467..85f557fc 100644 --- a/classKeccakCore-members.html +++ b/classKeccakCore-members.html @@ -102,12 +102,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); pad(uint8_t tag)KeccakCore reset()KeccakCore setCapacity(size_t capacity)KeccakCore - update(const void *data, size_t size)KeccakCore - ~KeccakCore()KeccakCore + setHMACKey(const void *key, size_t len, uint8_t pad, size_t hashSize)KeccakCore + update(const void *data, size_t size)KeccakCore + ~KeccakCore()KeccakCore diff --git a/classKeccakCore.html b/classKeccakCore.html index 3960d19e..60528414 100644 --- a/classKeccakCore.html +++ b/classKeccakCore.html @@ -130,6 +130,9 @@ Public Member Functions void clear ()  Clears all sensitive data from this object.
  +void setHMACKey (const void *key, size_t len, uint8_t pad, size_t hashSize) + Sets a HMAC key for a Keccak-based hash algorithm. More...

Detailed Description

Keccak core sponge function.

@@ -322,6 +325,58 @@ void 89 of file KeccakCore.cpp.

+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void KeccakCore::setHMACKey (const void * key,
size_t len,
uint8_t pad,
size_t hashSize 
)
+
+ +

Sets a HMAC key for a Keccak-based hash algorithm.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process.
lenLength of the HMAC key in bytes.
padInner (0x36) or outer (0x5C) padding value to XOR with the formatted HMAC key.
hashSizeThe size of the output from the hash algorithm.
+
+
+

This function is intended to help classes implement Hash::resetHMAC() and Hash::finalizeHMAC() by directly formatting the HMAC key into the internal block buffer and resetting the hash.

+ +

Definition at line 263 of file KeccakCore.cpp.

+
@@ -370,7 +425,7 @@ void  diff --git a/classLCD-members.html b/classLCD-members.html index 7100f2be..1713a93b 100644 --- a/classLCD-members.html +++ b/classLCD-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classLCD.html b/classLCD.html index 9cf7d268..ffc21529 100644 --- a/classLCD.html +++ b/classLCD.html @@ -528,7 +528,7 @@ Support for DFRobot LCD Shield diff --git a/classListField-members.html b/classListField-members.html index 5716eb43..e5a8b3ba 100644 --- a/classListField-members.html +++ b/classListField-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classListField.html b/classListField.html index 08ae4035..88f3cf9e 100644 --- a/classListField.html +++ b/classListField.html @@ -411,7 +411,7 @@ LiquidCrystal *  diff --git a/classMelody-members.html b/classMelody-members.html index 4d02f363..357c8e67 100644 --- a/classMelody-members.html +++ b/classMelody-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classMelody.html b/classMelody.html index 8352158a..bc0157fa 100644 --- a/classMelody.html +++ b/classMelody.html @@ -371,7 +371,7 @@ bool  diff --git a/classNoiseSource-members.html b/classNoiseSource-members.html index 36c1df58..2415e2f1 100644 --- a/classNoiseSource-members.html +++ b/classNoiseSource-members.html @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classNoiseSource.html b/classNoiseSource.html index e1b0f804..6ecce2c8 100644 --- a/classNoiseSource.html +++ b/classNoiseSource.html @@ -258,7 +258,7 @@ Protected Member Functions diff --git a/classOFB-members.html b/classOFB-members.html index 02a5fb33..90988877 100644 --- a/classOFB-members.html +++ b/classOFB-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOFB.html b/classOFB.html index b900aa3e..eae67039 100644 --- a/classOFB.html +++ b/classOFB.html @@ -181,7 +181,7 @@ class OFB< T > diff --git a/classOFBCommon-members.html b/classOFBCommon-members.html index 27223c02..de87b11b 100644 --- a/classOFBCommon-members.html +++ b/classOFBCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOFBCommon.html b/classOFBCommon.html index e77d2016..d4cec298 100644 --- a/classOFBCommon.html +++ b/classOFBCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classRNGClass-members.html b/classRNGClass-members.html index 91b65af0..24e6ebfc 100644 --- a/classRNGClass-members.html +++ b/classRNGClass-members.html @@ -90,22 +90,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

This is the complete list of members for RNGClass, including all inherited members.

- - - - - - - - - - - - + + + + + + + + + + + + +
available(size_t len) const RNGClass
begin(const char *tag, int eepromAddress)RNGClass
destroy()RNGClass
loop()RNGClass
rand(uint8_t *data, size_t len)RNGClass
RNGClass()RNGClass
save()RNGClass
SEED_SIZERNGClassstatic
setAutoSaveTime(uint16_t minutes)RNGClass
stir(const uint8_t *data, size_t len, unsigned int credit=0)RNGClass
stir(NoiseSource &source)RNGClass
~RNGClass()RNGClass
addNoiseSource(NoiseSource &source)RNGClass
available(size_t len) const RNGClass
begin(const char *tag, int eepromAddress)RNGClass
destroy()RNGClass
loop()RNGClass
rand(uint8_t *data, size_t len)RNGClass
RNGClass()RNGClass
save()RNGClass
SEED_SIZERNGClassstatic
setAutoSaveTime(uint16_t minutes)RNGClass
stir(const uint8_t *data, size_t len, unsigned int credit=0)RNGClass
stir(NoiseSource &source)RNGClass
~RNGClass()RNGClass
diff --git a/classRNGClass.html b/classRNGClass.html index d28d30c3..7c36802a 100644 --- a/classRNGClass.html +++ b/classRNGClass.html @@ -109,6 +109,9 @@ Public Member Functions void begin (const char *tag, int eepromAddress)  Initializes the random number generator. More...
  +void addNoiseSource (NoiseSource &source) + Adds a noise source to the random number generator. More...
+  void setAutoSaveTime (uint16_t minutes)  Sets the amount of time between automatic seed saves. More...
  @@ -173,15 +176,15 @@ static const int  // Stir in the Ethernet MAC address.
RNG.stir(mac_address, sizeof(mac_address));
+
// Add the noise source to the list of sources known to RNG.
+
RNG.addNoiseSource(noise);
+
// ...
}
-

The application should regularly call stir() to mix in new data from the noise source and also regularly call loop():

+

The application should regularly call loop() to stir in new data from the registered noise sources and to periodically save the seed:

void loop() {
// ...
-
// If the noise source has accumulated new entropy, then stir it in.
-
RNG.stir(noise);
-
// Perform regular housekeeping on the random number generator.
RNG.loop();
@@ -216,6 +219,34 @@ static const int Member Function Documentation + +
+
+ + + + + + + + +
void RNGClass::addNoiseSource (NoiseSourcesource)
+
+ +

Adds a noise source to the random number generator.

+
Parameters
+ + +
sourceThe noise source to add, which will be polled regularly by loop() to accumulate noise-based entropy from the source.
+
+
+

RNG supports a maximum of four noise sources. If the application needs more than that then the application must poll the noise sources itself by calling NoiseSource::stir() directly.

+
See Also
loop(), begin()
+ +

Definition at line 250 of file RNG.cpp.

+ +
+
@@ -255,7 +286,7 @@ static const int 
See Also
rand()
-

Definition at line 354 of file RNG.cpp.

+

Definition at line 374 of file RNG.cpp.

@@ -292,9 +323,9 @@ static const int stir() to mix in additional entropy data from noise sources to initialize the random number generator properly.

-
See Also
stir(), save()
+
See Also
addNoiseSource(), stir(), save()
-

Definition at line 202 of file RNG.cpp.

+

Definition at line 203 of file RNG.cpp.

@@ -317,7 +348,7 @@ static const int 
Note
The rand() and save() functions take some care to manage the random number pool in a way that makes prediction of past outputs from a captured state very difficult. Future outputs may be predictable if noise or other high-entropy data is not mixed in with stir() on a regular basis.
See Also
begin()
-

Definition at line 513 of file RNG.cpp.

+

Definition at line 537 of file RNG.cpp.

@@ -337,7 +368,7 @@ static const int  -

Definition at line 486 of file RNG.cpp.

+

Definition at line 506 of file RNG.cpp.

@@ -377,7 +408,7 @@ static const int available() function can be polled to determine when sufficient entropy is available.

See Also
available(), stir()
-

Definition at line 277 of file RNG.cpp.

+

Definition at line 297 of file RNG.cpp.

@@ -401,7 +432,7 @@ static const int stir() in new noise data at startup.

See Also
loop(), stir()
-

Definition at line 468 of file RNG.cpp.

+

Definition at line 488 of file RNG.cpp.

@@ -430,7 +461,7 @@ static const int 
See Also
save(), stir()
-

Definition at line 253 of file RNG.cpp.

+

Definition at line 273 of file RNG.cpp.

@@ -478,7 +509,7 @@ static const int 
See Also
loop()
-

Definition at line 387 of file RNG.cpp.

+

Definition at line 407 of file RNG.cpp.

@@ -505,7 +536,7 @@ static const int 
See Also
save(), NoiseSource::stir()
-

Definition at line 437 of file RNG.cpp.

+

Definition at line 457 of file RNG.cpp.

@@ -516,7 +547,7 @@ static const int  diff --git a/classRTC-members.html b/classRTC-members.html index 3bdd2d46..4ae9a9ea 100644 --- a/classRTC-members.html +++ b/classRTC-members.html @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTC.html b/classRTC.html index 1e8c9b01..4d78e1f1 100644 --- a/classRTC.html +++ b/classRTC.html @@ -778,7 +778,7 @@ static const uint8_t  diff --git a/classRTCAlarm-members.html b/classRTCAlarm-members.html index a47e1c96..2c50a755 100644 --- a/classRTCAlarm-members.html +++ b/classRTCAlarm-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTCDate-members.html b/classRTCDate-members.html index 6fe4168c..55e3125b 100644 --- a/classRTCDate-members.html +++ b/classRTCDate-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTCTime-members.html b/classRTCTime-members.html index 99afaffd..f0f2efb1 100644 --- a/classRTCTime-members.html +++ b/classRTCTime-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRingOscillatorNoiseSource-members.html b/classRingOscillatorNoiseSource-members.html index 90c2bed3..eafc5649 100644 --- a/classRingOscillatorNoiseSource-members.html +++ b/classRingOscillatorNoiseSource-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRingOscillatorNoiseSource.html b/classRingOscillatorNoiseSource.html index 3a587bda..f53b4aed 100644 --- a/classRingOscillatorNoiseSource.html +++ b/classRingOscillatorNoiseSource.html @@ -159,15 +159,15 @@ Additional Inherited Members
// "MyApp 1.0" and load the previous seed from EEPROM address 500.
RNG.begin("MyApp 1.0", 500);
+
// Add the noise source to the list of sources known to RNG.
+
RNG.addNoiseSource(noise);
+
// ...
}
void loop() {
// ...
-
// If the noise source has accumulated new entropy, then stir it in.
-
RNG.stir(noise);
-
// Perform regular housekeeping on the random number generator.
RNG.loop();
@@ -250,7 +250,7 @@ Additional Inherited Members diff --git a/classSHA1-members.html b/classSHA1-members.html index 93dc10ce..27fb89f0 100644 --- a/classSHA1-members.html +++ b/classSHA1-members.html @@ -94,20 +94,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); chunkSize (defined in SHA1)SHA1 clear()SHA1virtual finalize(void *hash, size_t len)SHA1virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA1virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected h (defined in SHA1)SHA1 Hash()Hash hashSize() const SHA1virtual length (defined in SHA1)SHA1 reset()SHA1virtual - SHA1()SHA1 - update(const void *data, size_t len)SHA1virtual - w (defined in SHA1)SHA1 - ~Hash()Hashvirtual - ~SHA1()SHA1virtual + resetHMAC(const void *key, size_t keyLen)SHA1virtual + SHA1()SHA1 + update(const void *data, size_t len)SHA1virtual + w (defined in SHA1)SHA1 + ~Hash()Hashvirtual + ~SHA1()SHA1virtual diff --git a/classSHA1.html b/classSHA1.html index 6ec612e7..2c3942e3 100644 --- a/classSHA1.html +++ b/classSHA1.html @@ -133,6 +133,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -141,6 +147,13 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

SHA-1 hash algorithm.

@@ -251,12 +264,74 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

Definition at line 97 of file SHA1.cpp.

+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void SHA1::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 141 of file SHA1.cpp.

+
@@ -311,12 +386,68 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

Definition at line 64 of file SHA1.cpp.

+ + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void SHA1::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 134 of file SHA1.cpp.

+
@@ -375,7 +506,7 @@ virtual  diff --git a/classSHA256-members.html b/classSHA256-members.html index e06a3bbe..c65c3f95 100644 --- a/classSHA256-members.html +++ b/classSHA256-members.html @@ -94,20 +94,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); chunkSize (defined in SHA256)SHA256 clear()SHA256virtual finalize(void *hash, size_t len)SHA256virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA256virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected h (defined in SHA256)SHA256 Hash()Hash hashSize() const SHA256virtual length (defined in SHA256)SHA256 reset()SHA256virtual - SHA256()SHA256 - update(const void *data, size_t len)SHA256virtual - w (defined in SHA256)SHA256 - ~Hash()Hashvirtual - ~SHA256()SHA256virtual + resetHMAC(const void *key, size_t keyLen)SHA256virtual + SHA256()SHA256 + update(const void *data, size_t len)SHA256virtual + w (defined in SHA256)SHA256 + ~Hash()Hashvirtual + ~SHA256()SHA256virtual diff --git a/classSHA256.html b/classSHA256.html index 47d8eb76..48b80e4e 100644 --- a/classSHA256.html +++ b/classSHA256.html @@ -133,6 +133,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -141,6 +147,13 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

SHA-256 hash algorithm.

@@ -251,12 +264,74 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

Definition at line 102 of file SHA256.cpp.

+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void SHA256::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 146 of file SHA256.cpp.

+
@@ -311,12 +386,68 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

Definition at line 66 of file SHA256.cpp.

+ + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void SHA256::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 139 of file SHA256.cpp.

+
@@ -375,7 +506,7 @@ virtual  diff --git a/classSHA3__256-members.html b/classSHA3__256-members.html index 93cc483d..873be372 100644 --- a/classSHA3__256-members.html +++ b/classSHA3__256-members.html @@ -93,17 +93,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); blockSize() const SHA3_256virtual clear()SHA3_256virtual finalize(void *hash, size_t len)SHA3_256virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA3_256virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected Hash()Hash hashSize() const SHA3_256virtual reset()SHA3_256virtual - SHA3_256()SHA3_256 - update(const void *data, size_t len)SHA3_256virtual - ~Hash()Hashvirtual - ~SHA3_256()SHA3_256virtual + resetHMAC(const void *key, size_t keyLen)SHA3_256virtual + SHA3_256()SHA3_256 + update(const void *data, size_t len)SHA3_256virtual + ~Hash()Hashvirtual + ~SHA3_256()SHA3_256virtual diff --git a/classSHA3__256.html b/classSHA3__256.html index 20b074f9..51cbdd21 100644 --- a/classSHA3__256.html +++ b/classSHA3__256.html @@ -133,6 +133,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -141,6 +147,13 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

SHA3-256 hash algorithm.

@@ -175,7 +188,7 @@ virtual Hash.

-

Definition at line 55 of file SHA3.cpp.

+

Definition at line 56 of file SHA3.cpp.

@@ -205,7 +218,7 @@ virtual Hash.

-

Definition at line 77 of file SHA3.cpp.

+

Definition at line 78 of file SHA3.cpp.

@@ -251,11 +264,73 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

-

Definition at line 70 of file SHA3.cpp.

+

Definition at line 71 of file SHA3.cpp.

+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void SHA3_256::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 88 of file SHA3.cpp.

@@ -285,7 +360,7 @@ virtual Hash.

-

Definition at line 50 of file SHA3.cpp.

+

Definition at line 51 of file SHA3.cpp.

@@ -311,11 +386,67 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

-

Definition at line 60 of file SHA3.cpp.

+

Definition at line 61 of file SHA3.cpp.

+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void SHA3_256::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 83 of file SHA3.cpp.

@@ -364,7 +495,7 @@ virtual Hash.

-

Definition at line 65 of file SHA3.cpp.

+

Definition at line 66 of file SHA3.cpp.

@@ -375,7 +506,7 @@ virtual  diff --git a/classSHA3__512-members.html b/classSHA3__512-members.html index c329e6e9..b31d79ba 100644 --- a/classSHA3__512-members.html +++ b/classSHA3__512-members.html @@ -93,17 +93,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); blockSize() const SHA3_512virtual clear()SHA3_512virtual finalize(void *hash, size_t len)SHA3_512virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA3_512virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected Hash()Hash hashSize() const SHA3_512virtual reset()SHA3_512virtual - SHA3_512()SHA3_512 - update(const void *data, size_t len)SHA3_512virtual - ~Hash()Hashvirtual - ~SHA3_512()SHA3_512virtual + resetHMAC(const void *key, size_t keyLen)SHA3_512virtual + SHA3_512()SHA3_512 + update(const void *data, size_t len)SHA3_512virtual + ~Hash()Hashvirtual + ~SHA3_512()SHA3_512virtual diff --git a/classSHA3__512.html b/classSHA3__512.html index 823b4fa0..edc418c0 100644 --- a/classSHA3__512.html +++ b/classSHA3__512.html @@ -133,6 +133,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -141,13 +147,20 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

SHA3-512 hash algorithm.

Reference: http://en.wikipedia.org/wiki/SHA-3

See Also
SHA3_256
-

Definition at line 48 of file SHA3.h.

+

Definition at line 51 of file SHA3.h.

Member Function Documentation

@@ -175,7 +188,7 @@ virtual Hash.

-

Definition at line 112 of file SHA3.cpp.

+

Definition at line 128 of file SHA3.cpp.

@@ -205,7 +218,7 @@ virtual Hash.

-

Definition at line 134 of file SHA3.cpp.

+

Definition at line 150 of file SHA3.cpp.

@@ -251,11 +264,73 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

-

Definition at line 127 of file SHA3.cpp.

+

Definition at line 143 of file SHA3.cpp.

+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void SHA3_512::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 160 of file SHA3.cpp.

@@ -285,7 +360,7 @@ virtual Hash.

-

Definition at line 107 of file SHA3.cpp.

+

Definition at line 123 of file SHA3.cpp.

@@ -311,11 +386,67 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

-

Definition at line 117 of file SHA3.cpp.

+

Definition at line 133 of file SHA3.cpp.

+ + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void SHA3_512::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 155 of file SHA3.cpp.

@@ -364,7 +495,7 @@ virtual Hash.

-

Definition at line 122 of file SHA3.cpp.

+

Definition at line 138 of file SHA3.cpp.

@@ -375,7 +506,7 @@ virtual  diff --git a/classSHA512-members.html b/classSHA512-members.html index 25c583e0..1f6b4b13 100644 --- a/classSHA512-members.html +++ b/classSHA512-members.html @@ -94,21 +94,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); chunkSize (defined in SHA512)SHA512 clear()SHA512virtual finalize(void *hash, size_t len)SHA512virtual + finalizeHMAC(const void *key, size_t keyLen, void *hash, size_t hashLen)SHA512virtual + formatHMACKey(void *block, const void *key, size_t len, uint8_t pad)Hashprotected h (defined in SHA512)SHA512 Hash()Hash hashSize() const SHA512virtual lengthHigh (defined in SHA512)SHA512 lengthLow (defined in SHA512)SHA512 reset()SHA512virtual - SHA512()SHA512 - update(const void *data, size_t len)SHA512virtual - w (defined in SHA512)SHA512 - ~Hash()Hashvirtual - ~SHA512()SHA512virtual + resetHMAC(const void *key, size_t keyLen)SHA512virtual + SHA512()SHA512 + update(const void *data, size_t len)SHA512virtual + w (defined in SHA512)SHA512 + ~Hash()Hashvirtual + ~SHA512()SHA512virtual diff --git a/classSHA512.html b/classSHA512.html index e78e2a29..05663b1f 100644 --- a/classSHA512.html +++ b/classSHA512.html @@ -133,6 +133,12 @@ virtual void clear ()  Clears the hash state, removing all sensitive data, and then resets the hash ready for a new hashing process. More...
  +void resetHMAC (const void *key, size_t keyLen) + Resets the hash ready for a new HMAC hashing process. More...
+  +void finalizeHMAC (const void *key, size_t keyLen, void *hash, size_t hashLen) + Finalizes the HMAC hashing process and returns the hash. More...
- Public Member Functions inherited from Hash  Hash () @@ -141,6 +147,13 @@ virtual virtual ~Hash ()  Destroys this hash object. More...
  + + + + + +

+Additional Inherited Members

- Protected Member Functions inherited from Hash
void formatHMACKey (void *block, const void *key, size_t len, uint8_t pad)
 Formats a HMAC key into a block. More...
 

Detailed Description

SHA-512 hash algorithm.

@@ -251,12 +264,74 @@ virtual hashSize(), then the hash value will be truncated to the first len bytes. If len is greater than hashSize(), then the remaining bytes will left unchanged.

If finalize() is called again, then the returned hash value is undefined. Call reset() first to start a new hashing process.

-
See Also
reset(), update()
+
See Also
reset(), update(), finalizeHMAC()

Implements Hash.

Definition at line 105 of file SHA512.cpp.

+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void SHA512::finalizeHMAC (const void * key,
size_t keyLen,
void * hash,
size_t hashLen 
)
+
+virtual
+
+ +

Finalizes the HMAC hashing process and returns the hash.

+
Parameters
+ + + + + +
keyPoints to the HMAC key for the hashing process. The contents of this array must be identical to the value passed to resetHMAC().
keyLenSize of the HMAC key in bytes.
hashThe buffer to return the hash value in.
hashLenThe length of the hash buffer, normally hashSize().
+
+
+
See Also
resetHMAC(), finalize()
+ +

Implements Hash.

+ +

Definition at line 149 of file SHA512.cpp.

+
@@ -311,12 +386,68 @@ virtual 

Resets the hash ready for a new hashing process.

-
See Also
update(), finalize()
+
See Also
update(), finalize(), resetHMAC()

Implements Hash.

Definition at line 66 of file SHA512.cpp.

+ + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void SHA512::resetHMAC (const void * key,
size_t keyLen 
)
+
+virtual
+
+ +

Resets the hash ready for a new HMAC hashing process.

+
Parameters
+ + + +
keyPoints to the HMAC key for the hashing process.
keyLenSize of the HMAC key in bytes.
+
+
+

The following example computes a HMAC over a series of data blocks with a specific key:

+
hash.resetHMAC(key, sizeof(key));
+
hash.update(data1, sizeof(data1));
+
hash.update(data2, sizeof(data2));
+
...
+
hash.update(dataN, sizeof(dataN));
+
hash.finalizeHMAC(key, sizeof(key), hmac, sizeof(hmac));
+

The same key must be passed to both resetHMAC() and finalizeHMAC().

+
See Also
finalizeHMAC(), reset()
+ +

Implements Hash.

+ +

Definition at line 142 of file SHA512.cpp.

+
@@ -375,7 +506,7 @@ virtual  diff --git a/classSoftI2C-members.html b/classSoftI2C-members.html index 3842013f..98f4c67c 100644 --- a/classSoftI2C-members.html +++ b/classSoftI2C-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSoftI2C.html b/classSoftI2C.html index be56e478..1d67fccd 100644 --- a/classSoftI2C.html +++ b/classSoftI2C.html @@ -346,7 +346,7 @@ unsigned int  diff --git a/classTextField-members.html b/classTextField-members.html index 217cdf6c..8aaf74a4 100644 --- a/classTextField-members.html +++ b/classTextField-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTextField.html b/classTextField.html index ee73a91c..b6b13b13 100644 --- a/classTextField.html +++ b/classTextField.html @@ -343,7 +343,7 @@ LiquidCrystal *  diff --git a/classTimeField-members.html b/classTimeField-members.html index b344902e..1af85218 100644 --- a/classTimeField-members.html +++ b/classTimeField-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTimeField.html b/classTimeField.html index fc91c6ca..e5031294 100644 --- a/classTimeField.html +++ b/classTimeField.html @@ -541,7 +541,7 @@ LiquidCrystal *  diff --git a/classTransistorNoiseSource-members.html b/classTransistorNoiseSource-members.html index 433f8c9f..8f78b139 100644 --- a/classTransistorNoiseSource-members.html +++ b/classTransistorNoiseSource-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTransistorNoiseSource.html b/classTransistorNoiseSource.html index beb53b88..e9d2ffc9 100644 --- a/classTransistorNoiseSource.html +++ b/classTransistorNoiseSource.html @@ -152,15 +152,15 @@ Additional Inherited Members
// "MyApp 1.0" and load the previous seed from EEPROM address 500.
RNG.begin("MyApp 1.0", 500);
+
// Add the noise source to the list of sources known to RNG.
+
RNG.addNoiseSource(noise);
+
// ...
}
void loop() {
// ...
-
// If the noise source has accumulated new entropy, then stir it in.
-
RNG.stir(noise);
-
// Perform regular housekeeping on the random number generator.
RNG.loop();
@@ -277,7 +277,7 @@ Additional Inherited Members diff --git a/classes.html b/classes.html index 186b3ad1..42e93466 100644 --- a/classes.html +++ b/classes.html @@ -129,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto-rng-ring_8dox.html b/crypto-rng-ring_8dox.html index 7952825c..b693e5d1 100644 --- a/crypto-rng-ring_8dox.html +++ b/crypto-rng-ring_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto-rng_8dox.html b/crypto-rng_8dox.html index 5e1ec0cf..28715136 100644 --- a/crypto-rng_8dox.html +++ b/crypto-rng_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto.html b/crypto.html index 79aa6fa4..192f4db7 100644 --- a/crypto.html +++ b/crypto.html @@ -85,7 +85,7 @@ Supported Algorithms
  • Block ciphers: AES128, AES192, AES256
  • Block cipher modes: CTR, CFB, CBC, OFB
  • Stream ciphers: ChaCha
  • -
  • Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b
  • +
  • Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b (regular and HMAC modes)
  • Public key algorithms: Curve25519
  • Random number generation: RNG, TransistorNoiseSource, RingOscillatorNoiseSource
  • @@ -145,7 +145,7 @@ Performance diff --git a/crypto_8dox.html b/crypto_8dox.html index c1fa35d8..aea5da98 100644 --- a/crypto_8dox.html +++ b/crypto_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto_rng.html b/crypto_rng.html index b7d316ba..7e00395c 100644 --- a/crypto_rng.html +++ b/crypto_rng.html @@ -110,12 +110,15 @@ Initializing the random number generator
    #include <TransistorNoiseSource.h>

    Next we create a global variable for the noise source and specify the I/O pin that the noise circuit is connected to:

    -

    Then in the setup() function we call RNG.begin() to start the random number generator running:

    +

    Then in the setup() function we call RNG.begin() to start the random number generator running and call RNG.addNoiseSource() to register all of the application's noise sources:

    void setup() {
    // Initialize the random number generator with the application tag
    // "MyApp 1.0" and load the previous seed from EEPROM address 500.
    RNG.begin("MyApp 1.0", 500);
    +
    // Add the noise source to the list of sources known to RNG.
    +
    RNG.addNoiseSource(noise);
    +
    // ...
    }

    The begin() function is passed two arguments: a tag string that should be different for every application and an EEPROM address to use to load and save the random number seed. The tag string ensures that different applications and versions will generate different random numbers upon first boot before the noise source has collected any entropy. If the device also has a unique serial number or a MAC address, then those can be mixed in during the setup() function after calling begin():

    @@ -123,17 +126,15 @@ Initializing the random number generator
    RNG.begin("MyApp 1.0", 500);
    RNG.stir(serial_number, sizeof(serial_number));
    RNG.stir(mac_address, sizeof(mac_address));
    +
    RNG.addNoiseSource(noise);
    ...
    }

    The random number generator needs 49 bytes of EEPROM space at the specified address to store the previous seed. When the system is started next time, the previous saved seed is loaded and then deliberately overwritten with a new seed. This ensures that the device will not accidentally generate the same sequence of random numbers if it is restarted before a new seed can be saved.

    By default the seed is saved once an hour, although this can be changed with RNG.setAutoSaveTime(). Because the device may be restarted before the first hour expires, there is a special case in the code: the first time that the entropy pool fills up, a save will be automatically forced.

    -

    To use the random number generator properly, there are some regular tasks that must be performed every time around the application's main loop(). Newly accumulated noise must be mixed in with RNG.stir() and the RNG.loop() function must be called to perform auto-saves:

    +

    To use the random number generator properly, there are some regular tasks that must be performed every time around the application's main loop(). Newly accumulated noise must be mixed in and auto-saves must be performed on a regular basis. The RNG.loop() function takes care of these tasks for us:

    void loop() {
    // ...
    -
    // If the noise source has accumulated new entropy, then stir it in.
    -
    RNG.stir(noise);
    -
    // Perform regular housekeeping on the random number generator.
    RNG.loop();
    @@ -181,7 +182,7 @@ Destroying secret data
    diff --git a/crypto_rng_ring.html b/crypto_rng_ring.html index 162dd90c..77b0f500 100644 --- a/crypto_rng_ring.html +++ b/crypto_rng_ring.html @@ -151,7 +151,7 @@ Connecting to the Arduino diff --git a/dir_1586d320a3b1e622174530fde769cda9.html b/dir_1586d320a3b1e622174530fde769cda9.html index 2bb3eded..095c3233 100644 --- a/dir_1586d320a3b1e622174530fde769cda9.html +++ b/dir_1586d320a3b1e622174530fde769cda9.html @@ -102,7 +102,7 @@ Files diff --git a/dir_48f64e79f12bd77ba047e9e436ec978c.html b/dir_48f64e79f12bd77ba047e9e436ec978c.html index 10a3df0c..909cb318 100644 --- a/dir_48f64e79f12bd77ba047e9e436ec978c.html +++ b/dir_48f64e79f12bd77ba047e9e436ec978c.html @@ -122,7 +122,7 @@ Files diff --git a/dir_5e87a7229a108582288ef7eda1233dc3.html b/dir_5e87a7229a108582288ef7eda1233dc3.html index 3754b447..568eb096 100644 --- a/dir_5e87a7229a108582288ef7eda1233dc3.html +++ b/dir_5e87a7229a108582288ef7eda1233dc3.html @@ -94,7 +94,7 @@ Files diff --git a/dir_6591a2127a29f6cea3994dcb5b0596d1.html b/dir_6591a2127a29f6cea3994dcb5b0596d1.html index 9f8af89e..0d65d929 100644 --- a/dir_6591a2127a29f6cea3994dcb5b0596d1.html +++ b/dir_6591a2127a29f6cea3994dcb5b0596d1.html @@ -106,7 +106,7 @@ Files diff --git a/dir_9a34040863d1190c0e01b23e6b44de01.html b/dir_9a34040863d1190c0e01b23e6b44de01.html index c5e30adc..308db987 100644 --- a/dir_9a34040863d1190c0e01b23e6b44de01.html +++ b/dir_9a34040863d1190c0e01b23e6b44de01.html @@ -96,7 +96,7 @@ Files diff --git a/dir_bc0718b08fb2015b8e59c47b2805f60c.html b/dir_bc0718b08fb2015b8e59c47b2805f60c.html index b1696c91..369840ef 100644 --- a/dir_bc0718b08fb2015b8e59c47b2805f60c.html +++ b/dir_bc0718b08fb2015b8e59c47b2805f60c.html @@ -108,7 +108,7 @@ Directories diff --git a/dir_be059bf9978ae156837504b1b8a7568c.html b/dir_be059bf9978ae156837504b1b8a7568c.html index 439c4096..e063834a 100644 --- a/dir_be059bf9978ae156837504b1b8a7568c.html +++ b/dir_be059bf9978ae156837504b1b8a7568c.html @@ -94,7 +94,7 @@ Files diff --git a/dir_e2ce51835550ba18edf07a8311722290.html b/dir_e2ce51835550ba18edf07a8311722290.html index 200a9240..1128d0bd 100644 --- a/dir_e2ce51835550ba18edf07a8311722290.html +++ b/dir_e2ce51835550ba18edf07a8311722290.html @@ -184,7 +184,7 @@ Files diff --git a/dir_f34881fcf60f680b800190d5274dfaea.html b/dir_f34881fcf60f680b800190d5274dfaea.html index 34cb1893..ceab8887 100644 --- a/dir_f34881fcf60f680b800190d5274dfaea.html +++ b/dir_f34881fcf60f680b800190d5274dfaea.html @@ -102,7 +102,7 @@ Files diff --git a/dir_f9b96888882c2691b8eeaeafd1b9501d.html b/dir_f9b96888882c2691b8eeaeafd1b9501d.html index 14672f9b..84bd73b3 100644 --- a/dir_f9b96888882c2691b8eeaeafd1b9501d.html +++ b/dir_f9b96888882c2691b8eeaeafd1b9501d.html @@ -102,7 +102,7 @@ Files diff --git a/dmd-demo_8dox.html b/dmd-demo_8dox.html index e0c22396..f2cf0480 100644 --- a/dmd-demo_8dox.html +++ b/dmd-demo_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd-running-figure_8dox.html b/dmd-running-figure_8dox.html index 7347f9ae..3e13351c 100644 --- a/dmd-running-figure_8dox.html +++ b/dmd-running-figure_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd_demo.html b/dmd_demo.html index 7a9d6b58..db4e5850 100644 --- a/dmd_demo.html +++ b/dmd_demo.html @@ -236,7 +236,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd_running_figure.html b/dmd_running_figure.html index 1fa1a655..4413d856 100644 --- a/dmd_running_figure.html +++ b/dmd_running_figure.html @@ -430,7 +430,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/files.html b/files.html index 93f351e8..b2fbee7f 100644 --- a/files.html +++ b/files.html @@ -187,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions.html b/functions.html index 01fb991b..c038ab33 100644 --- a/functions.html +++ b/functions.html @@ -126,6 +126,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • addField() : Form
  • +
  • addNoiseSource() +: RNGClass +
  • adjustDays() : RTC
  • @@ -169,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_b.html b/functions_b.html index d8f2fd8f..b1c49b0b 100644 --- a/functions_b.html +++ b/functions_b.html @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_c.html b/functions_c.html index 1ef0036e..0e54e5c2 100644 --- a/functions_c.html +++ b/functions_c.html @@ -203,7 +203,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_d.html b/functions_d.html index 3fe195f5..4c737476 100644 --- a/functions_d.html +++ b/functions_d.html @@ -234,7 +234,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_e.html b/functions_e.html index 52210987..03a70931 100644 --- a/functions_e.html +++ b/functions_e.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_enum.html b/functions_enum.html index ce612067..09a91d7c 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_eval.html b/functions_eval.html index 80f5368f..5dc06c12 100644 --- a/functions_eval.html +++ b/functions_eval.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_f.html b/functions_f.html index 508de313..07093d7b 100644 --- a/functions_f.html +++ b/functions_f.html @@ -142,24 +142,37 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , SHA3_512 , SHA512 +
  • finalizeHMAC() +: BLAKE2b +, BLAKE2s +, Hash +, SHA1 +, SHA256 +, SHA3_256 +, SHA3_512 +, SHA512 +
  • firedAlarm() : DS3232RTC
  • flags : RTCAlarm
  • -
  • Font -: Bitmap -
  • font() : Bitmap
  • +
  • Font +: Bitmap +
  • form() : Field
  • Form() : Form
  • +
  • formatHMACKey() +: Hash +
  • fromRGB() : DMD
  • @@ -167,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index 2bf6de40..bab4dd8b 100644 --- a/functions_func.html +++ b/functions_func.html @@ -125,6 +125,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • addField() : Form
  • +
  • addNoiseSource() +: RNGClass +
  • adjustDays() : RTC
  • @@ -162,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_b.html b/functions_func_b.html index b80d472d..52d29529 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_c.html b/functions_func_c.html index cbb8d874..8cc60668 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -199,7 +199,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_d.html b/functions_func_d.html index acbb7e7f..4e347fe1 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -221,7 +221,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_e.html b/functions_func_e.html index 3844e65a..80b29ee9 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -178,7 +178,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_f.html b/functions_func_f.html index a1a79a20..ab4f55bb 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -141,6 +141,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , SHA3_512 , SHA512 +
  • finalizeHMAC() +: BLAKE2b +, BLAKE2s +, Hash +, SHA1 +, SHA256 +, SHA3_256 +, SHA3_512 +, SHA512 +
  • firedAlarm() : DS3232RTC
  • @@ -153,6 +163,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Form() : Form
  • +
  • formatHMACKey() +: Hash +
  • fromRGB() : DMD
  • @@ -160,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_g.html b/functions_func_g.html index 1582ace6..5486986c 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -129,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_h.html b/functions_func_h.html index b012b035..d83965b2 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_i.html b/functions_func_i.html index 595e8c47..af0f34e8 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -169,7 +169,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_k.html b/functions_func_k.html index d751f08b..c457d2b6 100644 --- a/functions_func_k.html +++ b/functions_func_k.html @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_l.html b/functions_func_l.html index 2b5290ab..3c7eb604 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_m.html b/functions_func_m.html index 278846ec..e9eec9b5 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_n.html b/functions_func_n.html index 18894e9d..89e21e6d 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_o.html b/functions_func_o.html index 234f6579..4bd79899 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_p.html b/functions_func_p.html index d8d317e1..69185e70 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_r.html b/functions_func_r.html index 3df297d4..d7798a64 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • reset() : BLAKE2b -, BLAKE2s +, BLAKE2s , Hash , KeccakCore , SHA1 @@ -175,6 +175,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , SHA3_512 , SHA512
  • +
  • resetHMAC() +: BLAKE2b +, BLAKE2s +, Hash +, SHA1 +, SHA256 +, SHA3_256 +, SHA3_512 +, SHA512 +
  • resume() : BlinkLED
  • @@ -191,7 +201,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_s.html b/functions_func_s.html index 3ca675bc..8ce20150 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -170,6 +170,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • setFont() : Bitmap
  • +
  • setHMACKey() +: KeccakCore +
  • setHoldTime() : Charlieplex
  • @@ -301,7 +304,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • stir() : NoiseSource , RingOscillatorNoiseSource -, RNGClass +, RNGClass , TransistorNoiseSource
  • stop() @@ -329,7 +332,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_t.html b/functions_func_t.html index 6c7e49a3..b5603ef9 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -147,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_u.html b/functions_func_u.html index 8264d735..e5e4b707 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_v.html b/functions_func_v.html index 61234ab5..6622b91f 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_w.html b/functions_func_w.html index 7f698d1c..c12a1ca5 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_~.html b/functions_func_~.html index a56d8fa9..7b7cbe29 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -192,7 +192,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_g.html b/functions_g.html index 0c629c82..fcd54409 100644 --- a/functions_g.html +++ b/functions_g.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_h.html b/functions_h.html index b20d4b6c..912999a5 100644 --- a/functions_h.html +++ b/functions_h.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_i.html b/functions_i.html index 84e0b154..d5f6b7e5 100644 --- a/functions_i.html +++ b/functions_i.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_k.html b/functions_k.html index 4b8a8139..b147e93a 100644 --- a/functions_k.html +++ b/functions_k.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_l.html b/functions_l.html index 5e19a675..940e27f3 100644 --- a/functions_l.html +++ b/functions_l.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_m.html b/functions_m.html index 283e3c25..c493ab51 100644 --- a/functions_m.html +++ b/functions_m.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_n.html b/functions_n.html index 4f5523f7..352467a9 100644 --- a/functions_n.html +++ b/functions_n.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_o.html b/functions_o.html index b8ff4f02..802a0763 100644 --- a/functions_o.html +++ b/functions_o.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_p.html b/functions_p.html index 971c499e..5e8dfa4f 100644 --- a/functions_p.html +++ b/functions_p.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index 171e967c..9adb5088 100644 --- a/functions_r.html +++ b/functions_r.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • reset() : BLAKE2b -, BLAKE2s +, BLAKE2s , Hash , KeccakCore , SHA1 @@ -176,6 +176,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , SHA3_512 , SHA512
  • +
  • resetHMAC() +: BLAKE2b +, BLAKE2s +, Hash +, SHA1 +, SHA256 +, SHA3_256 +, SHA3_512 +, SHA512 +
  • resume() : BlinkLED
  • @@ -192,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_s.html b/functions_s.html index 7fd4f754..0696d05d 100644 --- a/functions_s.html +++ b/functions_s.html @@ -180,6 +180,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • setFont() : Bitmap
  • +
  • setHMACKey() +: KeccakCore +
  • setHoldTime() : Charlieplex
  • @@ -311,7 +314,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • stir() : NoiseSource , RingOscillatorNoiseSource -, RNGClass +, RNGClass , TransistorNoiseSource
  • stop() @@ -339,7 +342,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_t.html b/functions_t.html index cb080ca6..5191ddae 100644 --- a/functions_t.html +++ b/functions_t.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index 13c53554..31551702 100644 --- a/functions_type.html +++ b/functions_type.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_u.html b/functions_u.html index dbad967b..ba069d69 100644 --- a/functions_u.html +++ b/functions_u.html @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_v.html b/functions_v.html index e56b870f..6c428bbc 100644 --- a/functions_v.html +++ b/functions_v.html @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars.html b/functions_vars.html index 4addc2dc..d84776d8 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_w.html b/functions_w.html index f9eaa96f..a98db920 100644 --- a/functions_w.html +++ b/functions_w.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_y.html b/functions_y.html index bd3f2027..250cec2b 100644 --- a/functions_y.html +++ b/functions_y.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_~.html b/functions_~.html index 022e66c3..1a9a8ccd 100644 --- a/functions_~.html +++ b/functions_~.html @@ -193,7 +193,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/group__power__save.html b/group__power__save.html index 6c2e51ff..f8bba190 100644 --- a/group__power__save.html +++ b/group__power__save.html @@ -201,7 +201,7 @@ void  diff --git a/hierarchy.html b/hierarchy.html index 8dcb1cd4..9a87b639 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/index.html b/index.html index 78d499a0..758ef26a 100644 --- a/index.html +++ b/index.html @@ -130,7 +130,7 @@ Cryptographic Library
  • Block ciphers: AES128, AES192, AES256
  • Block cipher modes: CTR, CFB, CBC, OFB
  • Stream ciphers: ChaCha
  • -
  • Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b
  • +
  • Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b (regular and HMAC modes)
  • Public key algorithms: Curve25519
  • Random number generation: RNG, TransistorNoiseSource, RingOscillatorNoiseSource
  • @@ -151,7 +151,7 @@ Other diff --git a/ir-dumpir_8dox.html b/ir-dumpir_8dox.html index 67cbd808..2081171b 100644 --- a/ir-dumpir_8dox.html +++ b/ir-dumpir_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir-snake_8dox.html b/ir-snake_8dox.html index 9f66810f..a37c7716 100644 --- a/ir-snake_8dox.html +++ b/ir-snake_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir_dumpir.html b/ir_dumpir.html index 101252ad..b417052d 100644 --- a/ir_dumpir.html +++ b/ir_dumpir.html @@ -283,7 +283,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir_snake.html b/ir_snake.html index e82d9770..127d201b 100644 --- a/ir_snake.html +++ b/ir_snake.html @@ -273,7 +273,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd-form_8dox.html b/lcd-form_8dox.html index f4a9ecdf..2b84a38a 100644 --- a/lcd-form_8dox.html +++ b/lcd-form_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd-helloworld_8dox.html b/lcd-helloworld_8dox.html index 4b7a42e7..b424d7e7 100644 --- a/lcd-helloworld_8dox.html +++ b/lcd-helloworld_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd_form.html b/lcd_form.html index b67672bf..cf76c5b2 100644 --- a/lcd_form.html +++ b/lcd_form.html @@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd_hello_world.html b/lcd_hello_world.html index 4e59c9ed..20528192 100644 --- a/lcd_hello_world.html +++ b/lcd_hello_world.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/mainpage_8dox.html b/mainpage_8dox.html index 072c89f5..890a2d56 100644 --- a/mainpage_8dox.html +++ b/mainpage_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/modules.html b/modules.html index 8fae45a2..d3c06716 100644 --- a/modules.html +++ b/modules.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/pages.html b/pages.html index fa1f32c1..a1b6a0e5 100644 --- a/pages.html +++ b/pages.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/search/all_0.js b/search/all_0.js index 7bd3c287..02e008ed 100644 --- a/search/all_0.js +++ b/search/all_0.js @@ -1,6 +1,7 @@ var searchData= [ ['addfield',['addField',['../classForm.html#a5cb056ace428e75e321610555bfecac7',1,'Form']]], + ['addnoisesource',['addNoiseSource',['../classRNGClass.html#aacf23b192b0e4cc8726d9abe05f5a9db',1,'RNGClass']]], ['adjustdays',['adjustDays',['../classRTC.html#adc29d7c43efc5a192d21965da5c3ee1d',1,'RTC']]], ['adjustmonths',['adjustMonths',['../classRTC.html#aeca597e6e37a05716e664242f9cfc5f4',1,'RTC']]], ['adjustyears',['adjustYears',['../classRTC.html#a31d10cb2f7cac8839bd4be2d858b802d',1,'RTC']]], diff --git a/search/all_10.js b/search/all_10.js index 71b32c3b..112474d2 100644 --- a/search/all_10.js +++ b/search/all_10.js @@ -19,6 +19,7 @@ var searchData= ['setdoublebuffer',['setDoubleBuffer',['../classDMD.html#a6fbdcf8832f91d02500cb7a9b84d2723',1,'DMD']]], ['setfalselabel',['setFalseLabel',['../classBoolField.html#ae6a29d27139fd78f2ca96152059fb30a',1,'BoolField']]], ['setfont',['setFont',['../classBitmap.html#a64d7a9651d5c385a044cc910a3b82837',1,'Bitmap']]], + ['sethmackey',['setHMACKey',['../classKeccakCore.html#aeff6b3357916bf426b60d3629db52628',1,'KeccakCore']]], ['setholdtime',['setHoldTime',['../classCharlieplex.html#a8502f4c752faba37023ced587695f6a4',1,'Charlieplex']]], ['setitems',['setItems',['../classListField.html#ae6709bce9355451b651893691456704e',1,'ListField']]], ['setiv',['setIV',['../classCBCCommon.html#ac7a586217835055b3a354bb932db160c',1,'CBCCommon::setIV()'],['../classCFBCommon.html#a597040eb7df40adbbef94b4c3975cd80',1,'CFBCommon::setIV()'],['../classChaCha.html#a734f3246b1e6810c63637b8cda26b259',1,'ChaCha::setIV()'],['../classCipher.html#a3777acd8ff776a4e945bb7c9f2d044d9',1,'Cipher::setIV()'],['../classCTRCommon.html#aad289af3eb013cb3ffda6d7e8e8b3d04',1,'CTRCommon::setIV()'],['../classOFBCommon.html#a4a35364cf30d78f1968cc00803686caf',1,'OFBCommon::setIV()']]], diff --git a/search/all_5.js b/search/all_5.js index 1019d471..c08a399d 100644 --- a/search/all_5.js +++ b/search/all_5.js @@ -4,10 +4,12 @@ var searchData= ['field',['Field',['../classField.html',1,'Field'],['../classField.html#ac4ea0d104376233c3f0bfc080ec8564e',1,'Field::Field(const String &label)'],['../classField.html#a7e2bdb203ddfd9219696f263c1731fe7',1,'Field::Field(Form &form, const String &label)']]], ['fill',['fill',['../classBitmap.html#a99da820f9280aace6b512801d5a5e2b2',1,'Bitmap::fill(int x, int y, int width, int height, Color color)'],['../classBitmap.html#ac661adab340858b541a2fe44e6303f56',1,'Bitmap::fill(int x, int y, int width, int height, Bitmap::ProgMem pattern, Color color=White)']]], ['finalize',['finalize',['../classBLAKE2b.html#a0cd8146b7868bd0f4c24a3856f106d17',1,'BLAKE2b::finalize()'],['../classBLAKE2s.html#a751a3d772cbe1cd1dad83dbd09853b1b',1,'BLAKE2s::finalize()'],['../classHash.html#a09b3ccec22763fc86b1415695862977c',1,'Hash::finalize()'],['../classSHA1.html#a5a6a8a6169aa48e0bccadb22a149ab7c',1,'SHA1::finalize()'],['../classSHA256.html#a695157bcdf5495ba892ebac309f3abd6',1,'SHA256::finalize()'],['../classSHA3__256.html#a8fe7cad1f83bd1bae1a0d521324247a1',1,'SHA3_256::finalize()'],['../classSHA3__512.html#ac0227aafb5f047bb50f0bd84df0b4b5b',1,'SHA3_512::finalize()'],['../classSHA512.html#afc136ad0e77de527b031db3fb8b32464',1,'SHA512::finalize()']]], + ['finalizehmac',['finalizeHMAC',['../classBLAKE2b.html#a29fafbba26e3c1d896b4d4c428f7d52a',1,'BLAKE2b::finalizeHMAC()'],['../classBLAKE2s.html#a3f910f3bd48cc4a9c5330c31bcda31fc',1,'BLAKE2s::finalizeHMAC()'],['../classHash.html#aab42fa5420cc0bda4321a3d3866cfd06',1,'Hash::finalizeHMAC()'],['../classSHA1.html#a791db53fe9d6cc0e383b25f1da0a97b8',1,'SHA1::finalizeHMAC()'],['../classSHA256.html#a28bc2510c5bdaf210a012f9f21a753cd',1,'SHA256::finalizeHMAC()'],['../classSHA3__256.html#a001215fa1b7d2c30717b4b5b1618d68c',1,'SHA3_256::finalizeHMAC()'],['../classSHA3__512.html#a25c9d2da26d01d46ba6b72c8a7905ea0',1,'SHA3_512::finalizeHMAC()'],['../classSHA512.html#a1fe9533f0d3dfdb426eb3dc4bdc31904',1,'SHA512::finalizeHMAC()']]], ['firedalarm',['firedAlarm',['../classDS3232RTC.html#a79649f100a4562b9c1ba7c69e85cbca3',1,'DS3232RTC']]], ['flags',['flags',['../structRTCAlarm.html#a0f2ef7363cb60a26642d5295b77ca19e',1,'RTCAlarm']]], ['font',['Font',['../classBitmap.html#a456f7d6da03189c1e7148563a891b3cf',1,'Bitmap::Font()'],['../classBitmap.html#a7bf0a232b4bd12573cc570cc0edef47c',1,'Bitmap::font() const ']]], ['form',['Form',['../classForm.html',1,'Form'],['../classForm.html#ad30836b22edde707a52d94090b716996',1,'Form::Form()'],['../classField.html#a27427319be1cc92db3128637d8884ee5',1,'Field::form()']]], + ['formathmackey',['formatHMACKey',['../classHash.html#ab6f40c9af91dc3d738d9fcce59af63cc',1,'Hash']]], ['fromrgb',['fromRGB',['../classDMD.html#a557412f734fc4596e1102bf71e110ea0',1,'DMD']]], ['form_20example_20for_20lcd_20displays',['Form example for LCD displays',['../lcd_form.html',1,'']]] ]; diff --git a/search/all_f.js b/search/all_f.js index 14b731e3..b7eecfbf 100644 --- a/search/all_f.js +++ b/search/all_f.js @@ -13,6 +13,7 @@ var searchData= ['refresh',['refresh',['../classCharlieplex.html#a3c961bfff866e400dad371f0376f096b',1,'Charlieplex::refresh()'],['../classDMD.html#a9e4bf2a9d247312d35c1401ff61261c8',1,'DMD::refresh()']]], ['removefield',['removeField',['../classForm.html#a7abd717029f9b19ee7318470072cd697',1,'Form']]], ['reset',['reset',['../classBLAKE2b.html#a917beae2ca6e9831a35717a526089e8a',1,'BLAKE2b::reset()'],['../classBLAKE2b.html#a9afd8ec05ccfa08a922de74461e45387',1,'BLAKE2b::reset(uint8_t outputLength)'],['../classBLAKE2s.html#a778776d15316c182fdb2df5a89b3ca02',1,'BLAKE2s::reset()'],['../classBLAKE2s.html#a91ba6bc39e42002ac61114ced1d0af6d',1,'BLAKE2s::reset(uint8_t outputLength)'],['../classHash.html#a7b94309acaa5f52386785fb780e5be61',1,'Hash::reset()'],['../classKeccakCore.html#a5a322eb7e3b5c1eaad127c9c6e6a529b',1,'KeccakCore::reset()'],['../classSHA1.html#ab71aaf39ed956320054861a2fbfa454f',1,'SHA1::reset()'],['../classSHA256.html#ad9d80d8fdccffb15497bd36285afce65',1,'SHA256::reset()'],['../classSHA3__256.html#a57b5f29347a733e04fe47d60621f3202',1,'SHA3_256::reset()'],['../classSHA3__512.html#a435746d5a8b012f7c65050337cc4a23f',1,'SHA3_512::reset()'],['../classSHA512.html#a0d009e8d9157c3f14323e68631c33e97',1,'SHA512::reset()']]], + ['resethmac',['resetHMAC',['../classBLAKE2b.html#acb1ca4081c509d1c34b3aee465cd4494',1,'BLAKE2b::resetHMAC()'],['../classBLAKE2s.html#a7f9745854704b34a508497105ca5e2fd',1,'BLAKE2s::resetHMAC()'],['../classHash.html#adf50359c1f525af884721cc9034e7945',1,'Hash::resetHMAC()'],['../classSHA1.html#ad0a09a5100d59ff90c04ed5d4071b606',1,'SHA1::resetHMAC()'],['../classSHA256.html#a2271683d6f1c7c103272f1dec55a6871',1,'SHA256::resetHMAC()'],['../classSHA3__256.html#a324fe4d268bbf23d7b492033fe3bc632',1,'SHA3_256::resetHMAC()'],['../classSHA3__512.html#aac7133f420f2be0288965c2e863f389b',1,'SHA3_512::resetHMAC()'],['../classSHA512.html#a2427ad8bf8b6958df91bd5806986167c',1,'SHA512::resetHMAC()']]], ['resume',['resume',['../classBlinkLED.html#a380241e4dfd20e8a558487227f2f4252',1,'BlinkLED']]], ['ringoscillatornoisesource',['RingOscillatorNoiseSource',['../classRingOscillatorNoiseSource.html',1,'']]], ['rngclass',['RNGClass',['../classRNGClass.html',1,'RNGClass'],['../classRNGClass.html#acbcf327242f51ae2d9209aeaa45e30e9',1,'RNGClass::RNGClass()']]], diff --git a/search/functions_0.js b/search/functions_0.js index 86c3fcfa..9a816c0e 100644 --- a/search/functions_0.js +++ b/search/functions_0.js @@ -1,6 +1,7 @@ var searchData= [ ['addfield',['addField',['../classForm.html#a5cb056ace428e75e321610555bfecac7',1,'Form']]], + ['addnoisesource',['addNoiseSource',['../classRNGClass.html#aacf23b192b0e4cc8726d9abe05f5a9db',1,'RNGClass']]], ['adjustdays',['adjustDays',['../classRTC.html#adc29d7c43efc5a192d21965da5c3ee1d',1,'RTC']]], ['adjustmonths',['adjustMonths',['../classRTC.html#aeca597e6e37a05716e664242f9cfc5f4',1,'RTC']]], ['adjustyears',['adjustYears',['../classRTC.html#a31d10cb2f7cac8839bd4be2d858b802d',1,'RTC']]], diff --git a/search/functions_10.js b/search/functions_10.js index 104b08f0..6a834aa4 100644 --- a/search/functions_10.js +++ b/search/functions_10.js @@ -15,6 +15,7 @@ var searchData= ['setdoublebuffer',['setDoubleBuffer',['../classDMD.html#a6fbdcf8832f91d02500cb7a9b84d2723',1,'DMD']]], ['setfalselabel',['setFalseLabel',['../classBoolField.html#ae6a29d27139fd78f2ca96152059fb30a',1,'BoolField']]], ['setfont',['setFont',['../classBitmap.html#a64d7a9651d5c385a044cc910a3b82837',1,'Bitmap']]], + ['sethmackey',['setHMACKey',['../classKeccakCore.html#aeff6b3357916bf426b60d3629db52628',1,'KeccakCore']]], ['setholdtime',['setHoldTime',['../classCharlieplex.html#a8502f4c752faba37023ced587695f6a4',1,'Charlieplex']]], ['setitems',['setItems',['../classListField.html#ae6709bce9355451b651893691456704e',1,'ListField']]], ['setiv',['setIV',['../classCBCCommon.html#ac7a586217835055b3a354bb932db160c',1,'CBCCommon::setIV()'],['../classCFBCommon.html#a597040eb7df40adbbef94b4c3975cd80',1,'CFBCommon::setIV()'],['../classChaCha.html#a734f3246b1e6810c63637b8cda26b259',1,'ChaCha::setIV()'],['../classCipher.html#a3777acd8ff776a4e945bb7c9f2d044d9',1,'Cipher::setIV()'],['../classCTRCommon.html#aad289af3eb013cb3ffda6d7e8e8b3d04',1,'CTRCommon::setIV()'],['../classOFBCommon.html#a4a35364cf30d78f1968cc00803686caf',1,'OFBCommon::setIV()']]], diff --git a/search/functions_5.js b/search/functions_5.js index e119aa1d..1709eb0e 100644 --- a/search/functions_5.js +++ b/search/functions_5.js @@ -4,8 +4,10 @@ var searchData= ['field',['Field',['../classField.html#ac4ea0d104376233c3f0bfc080ec8564e',1,'Field::Field(const String &label)'],['../classField.html#a7e2bdb203ddfd9219696f263c1731fe7',1,'Field::Field(Form &form, const String &label)']]], ['fill',['fill',['../classBitmap.html#a99da820f9280aace6b512801d5a5e2b2',1,'Bitmap::fill(int x, int y, int width, int height, Color color)'],['../classBitmap.html#ac661adab340858b541a2fe44e6303f56',1,'Bitmap::fill(int x, int y, int width, int height, Bitmap::ProgMem pattern, Color color=White)']]], ['finalize',['finalize',['../classBLAKE2b.html#a0cd8146b7868bd0f4c24a3856f106d17',1,'BLAKE2b::finalize()'],['../classBLAKE2s.html#a751a3d772cbe1cd1dad83dbd09853b1b',1,'BLAKE2s::finalize()'],['../classHash.html#a09b3ccec22763fc86b1415695862977c',1,'Hash::finalize()'],['../classSHA1.html#a5a6a8a6169aa48e0bccadb22a149ab7c',1,'SHA1::finalize()'],['../classSHA256.html#a695157bcdf5495ba892ebac309f3abd6',1,'SHA256::finalize()'],['../classSHA3__256.html#a8fe7cad1f83bd1bae1a0d521324247a1',1,'SHA3_256::finalize()'],['../classSHA3__512.html#ac0227aafb5f047bb50f0bd84df0b4b5b',1,'SHA3_512::finalize()'],['../classSHA512.html#afc136ad0e77de527b031db3fb8b32464',1,'SHA512::finalize()']]], + ['finalizehmac',['finalizeHMAC',['../classBLAKE2b.html#a29fafbba26e3c1d896b4d4c428f7d52a',1,'BLAKE2b::finalizeHMAC()'],['../classBLAKE2s.html#a3f910f3bd48cc4a9c5330c31bcda31fc',1,'BLAKE2s::finalizeHMAC()'],['../classHash.html#aab42fa5420cc0bda4321a3d3866cfd06',1,'Hash::finalizeHMAC()'],['../classSHA1.html#a791db53fe9d6cc0e383b25f1da0a97b8',1,'SHA1::finalizeHMAC()'],['../classSHA256.html#a28bc2510c5bdaf210a012f9f21a753cd',1,'SHA256::finalizeHMAC()'],['../classSHA3__256.html#a001215fa1b7d2c30717b4b5b1618d68c',1,'SHA3_256::finalizeHMAC()'],['../classSHA3__512.html#a25c9d2da26d01d46ba6b72c8a7905ea0',1,'SHA3_512::finalizeHMAC()'],['../classSHA512.html#a1fe9533f0d3dfdb426eb3dc4bdc31904',1,'SHA512::finalizeHMAC()']]], ['firedalarm',['firedAlarm',['../classDS3232RTC.html#a79649f100a4562b9c1ba7c69e85cbca3',1,'DS3232RTC']]], ['font',['font',['../classBitmap.html#a7bf0a232b4bd12573cc570cc0edef47c',1,'Bitmap']]], ['form',['Form',['../classForm.html#ad30836b22edde707a52d94090b716996',1,'Form::Form()'],['../classField.html#a27427319be1cc92db3128637d8884ee5',1,'Field::form()']]], + ['formathmackey',['formatHMACKey',['../classHash.html#ab6f40c9af91dc3d738d9fcce59af63cc',1,'Hash']]], ['fromrgb',['fromRGB',['../classDMD.html#a557412f734fc4596e1102bf71e110ea0',1,'DMD']]] ]; diff --git a/search/functions_f.js b/search/functions_f.js index 874a2fee..b24ec201 100644 --- a/search/functions_f.js +++ b/search/functions_f.js @@ -11,6 +11,7 @@ var searchData= ['refresh',['refresh',['../classCharlieplex.html#a3c961bfff866e400dad371f0376f096b',1,'Charlieplex::refresh()'],['../classDMD.html#a9e4bf2a9d247312d35c1401ff61261c8',1,'DMD::refresh()']]], ['removefield',['removeField',['../classForm.html#a7abd717029f9b19ee7318470072cd697',1,'Form']]], ['reset',['reset',['../classBLAKE2b.html#a917beae2ca6e9831a35717a526089e8a',1,'BLAKE2b::reset()'],['../classBLAKE2b.html#a9afd8ec05ccfa08a922de74461e45387',1,'BLAKE2b::reset(uint8_t outputLength)'],['../classBLAKE2s.html#a778776d15316c182fdb2df5a89b3ca02',1,'BLAKE2s::reset()'],['../classBLAKE2s.html#a91ba6bc39e42002ac61114ced1d0af6d',1,'BLAKE2s::reset(uint8_t outputLength)'],['../classHash.html#a7b94309acaa5f52386785fb780e5be61',1,'Hash::reset()'],['../classKeccakCore.html#a5a322eb7e3b5c1eaad127c9c6e6a529b',1,'KeccakCore::reset()'],['../classSHA1.html#ab71aaf39ed956320054861a2fbfa454f',1,'SHA1::reset()'],['../classSHA256.html#ad9d80d8fdccffb15497bd36285afce65',1,'SHA256::reset()'],['../classSHA3__256.html#a57b5f29347a733e04fe47d60621f3202',1,'SHA3_256::reset()'],['../classSHA3__512.html#a435746d5a8b012f7c65050337cc4a23f',1,'SHA3_512::reset()'],['../classSHA512.html#a0d009e8d9157c3f14323e68631c33e97',1,'SHA512::reset()']]], + ['resethmac',['resetHMAC',['../classBLAKE2b.html#acb1ca4081c509d1c34b3aee465cd4494',1,'BLAKE2b::resetHMAC()'],['../classBLAKE2s.html#a7f9745854704b34a508497105ca5e2fd',1,'BLAKE2s::resetHMAC()'],['../classHash.html#adf50359c1f525af884721cc9034e7945',1,'Hash::resetHMAC()'],['../classSHA1.html#ad0a09a5100d59ff90c04ed5d4071b606',1,'SHA1::resetHMAC()'],['../classSHA256.html#a2271683d6f1c7c103272f1dec55a6871',1,'SHA256::resetHMAC()'],['../classSHA3__256.html#a324fe4d268bbf23d7b492033fe3bc632',1,'SHA3_256::resetHMAC()'],['../classSHA3__512.html#aac7133f420f2be0288965c2e863f389b',1,'SHA3_512::resetHMAC()'],['../classSHA512.html#a2427ad8bf8b6958df91bd5806986167c',1,'SHA512::resetHMAC()']]], ['resume',['resume',['../classBlinkLED.html#a380241e4dfd20e8a558487227f2f4252',1,'BlinkLED']]], ['rngclass',['RNGClass',['../classRNGClass.html#acbcf327242f51ae2d9209aeaa45e30e9',1,'RNGClass']]], ['rtc',['RTC',['../classRTC.html#ada31c5120d18d2dd2863b3d440308da2',1,'RTC']]], diff --git a/structRTCAlarm.html b/structRTCAlarm.html index 0fcf8c63..716f1ffc 100644 --- a/structRTCAlarm.html +++ b/structRTCAlarm.html @@ -140,7 +140,7 @@ uint8_t  diff --git a/structRTCDate.html b/structRTCDate.html index 5ae2236d..38da2ad0 100644 --- a/structRTCDate.html +++ b/structRTCDate.html @@ -123,7 +123,7 @@ uint8_t  diff --git a/structRTCTime.html b/structRTCTime.html index 376c0c67..5774aab8 100644 --- a/structRTCTime.html +++ b/structRTCTime.html @@ -123,7 +123,7 @@ uint8_t