MeterLogger
Macros | Functions | Variables
sha256.c File Reference
#include <esp8266.h>
#include <string.h>
#include <stdint.h>
#include "crypto/crypto.h"
#include "crypto/sha256.h"
Include dependency graph for sha256.c:

Go to the source code of this file.

Macros

#define LITTLE_ENDIAN   1234
 
#define BIG_ENDIAN   4321
 
#define BYTE_ORDER   LITTLE_ENDIAN
 
#define SHA256_SHORT_BLOCK_LENGTH   (SHA256_BLOCK_LENGTH - 8)
 
#define REVERSE32(w, x)
 
#define REVERSE64(w, x)
 
#define ADDINC128(w, n)
 
#define R(b, x)   ((x) >> (b))
 
#define S32(b, x)   (((x) >> (b)) | ((x) << (32 - (b))))
 
#define S64(b, x)   (((x) >> (b)) | ((x) << (64 - (b))))
 
#define Ch(x, y, z)   (((x) & (y)) ^ ((~(x)) & (z)))
 
#define Maj(x, y, z)   (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
 
#define Sigma0_256(x)   (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x)))
 
#define Sigma1_256(x)   (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x)))
 
#define sigma0_256(x)   (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x)))
 
#define sigma1_256(x)   (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x)))
 
#define Sigma0_512(x)   (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x)))
 
#define Sigma1_512(x)   (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x)))
 
#define sigma0_512(x)   (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x)))
 
#define sigma1_512(x)   (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x)))
 

Functions

void sha256_transform (sha256_ctx_t *, uint8_t *)
 
ICACHE_FLASH_ATTR void sha256_init (sha256_ctx_t *context)
 
ICACHE_FLASH_ATTR void sha256_update (sha256_ctx_t *context, uint8_t *data, size_t len)
 
ICACHE_FLASH_ATTR void sha256_final (sha256_ctx_t *context, uint8_t digest[SHA256_DIGEST_LENGTH])
 
ICACHE_FLASH_ATTR char * sha256_end (sha256_ctx_t *context, char buffer[SHA256_DIGEST_STRING_LENGTH])
 
ICACHE_FLASH_ATTR void sha256_raw (uint8_t *data, size_t len, uint8_t digest[SHA256_DIGEST_LENGTH])
 
ICACHE_FLASH_ATTR char * sha256_data (uint8_t *data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH])
 

Variables

static const uint32_t K256 [64]
 
static const uint32_t sha256_initial_hash_value [8]
 
static const char * sha2_hex_digits = "0123456789abcdef"
 

Macro Definition Documentation

◆ ADDINC128

#define ADDINC128 (   w,
 
)
Value:
{ \
(w)[0] += (uint64_t)(n); \
if ((w)[0] < (n)) { \
(w)[1]++; \
} \
}

Definition at line 107 of file sha256.c.

◆ BIG_ENDIAN

#define BIG_ENDIAN   4321

Definition at line 69 of file sha256.c.

◆ BYTE_ORDER

#define BYTE_ORDER   LITTLE_ENDIAN

Definition at line 73 of file sha256.c.

◆ Ch

#define Ch (   x,
  y,
 
)    (((x) & (y)) ^ ((~(x)) & (z)))

Definition at line 131 of file sha256.c.

Referenced by sha256_transform().

◆ LITTLE_ENDIAN

#define LITTLE_ENDIAN   1234

Copyright (c) 2000-2001 Aaron D. Gifford Copyright (c) 2013-2014 Pavol Rusnak All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 68 of file sha256.c.

◆ Maj

#define Maj (   x,
  y,
 
)    (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))

Definition at line 132 of file sha256.c.

Referenced by sha256_transform().

◆ R

#define R (   b,
 
)    ((x) >> (b))

Definition at line 124 of file sha256.c.

◆ REVERSE32

#define REVERSE32 (   w,
 
)
Value:
{ \
uint32_t tmp = (w); \
tmp = (tmp >> 16) | (tmp << 16); \
(x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
}

Definition at line 87 of file sha256.c.

Referenced by sha256_final().

◆ REVERSE64

#define REVERSE64 (   w,
 
)
Value:
{ \
uint64_t tmp = (w); \
tmp = (tmp >> 32) | (tmp << 32); \
tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \
((tmp & 0x00ff00ff00ff00ffULL) << 8); \
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
((tmp & 0x0000ffff0000ffffULL) << 16); \
}

Definition at line 92 of file sha256.c.

Referenced by sha256_final().

◆ S32

#define S32 (   b,
 
)    (((x) >> (b)) | ((x) << (32 - (b))))

Definition at line 126 of file sha256.c.

◆ S64

#define S64 (   b,
 
)    (((x) >> (b)) | ((x) << (64 - (b))))

Definition at line 128 of file sha256.c.

◆ SHA256_SHORT_BLOCK_LENGTH

#define SHA256_SHORT_BLOCK_LENGTH   (SHA256_BLOCK_LENGTH - 8)

Definition at line 82 of file sha256.c.

Referenced by sha256_final().

◆ Sigma0_256

#define Sigma0_256 (   x)    (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x)))

Definition at line 135 of file sha256.c.

Referenced by sha256_transform().

◆ sigma0_256

#define sigma0_256 (   x)    (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x)))

Definition at line 137 of file sha256.c.

Referenced by sha256_transform().

◆ Sigma0_512

#define Sigma0_512 (   x)    (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x)))

Definition at line 141 of file sha256.c.

◆ sigma0_512

#define sigma0_512 (   x)    (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x)))

Definition at line 143 of file sha256.c.

◆ Sigma1_256

#define Sigma1_256 (   x)    (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x)))

Definition at line 136 of file sha256.c.

Referenced by sha256_transform().

◆ sigma1_256

#define sigma1_256 (   x)    (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x)))

Definition at line 138 of file sha256.c.

Referenced by sha256_transform().

◆ Sigma1_512

#define Sigma1_512 (   x)    (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x)))

Definition at line 142 of file sha256.c.

◆ sigma1_512

#define sigma1_512 (   x)    (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x)))

Definition at line 144 of file sha256.c.

Function Documentation

◆ sha256_data()

ICACHE_FLASH_ATTR char* sha256_data ( uint8_t *  data,
size_t  len,
char  digest[SHA256_DIGEST_STRING_LENGTH] 
)

Definition at line 430 of file sha256.c.

References sha256_end(), sha256_init(), and sha256_update().

430  {
431  sha256_ctx_t context;
432 
433  sha256_init(&context);
434  sha256_update(&context, data, len);
435  return sha256_end(&context, digest);
436 }
ICACHE_FLASH_ATTR char * sha256_end(sha256_ctx_t *context, char buffer[SHA256_DIGEST_STRING_LENGTH])
Definition: sha256.c:399
ICACHE_FLASH_ATTR void sha256_init(sha256_ctx_t *context)
Definition: sha256.c:196
ICACHE_FLASH_ATTR void sha256_update(sha256_ctx_t *context, uint8_t *data, size_t len)
Definition: sha256.c:288
Here is the call graph for this function:

◆ sha256_end()

ICACHE_FLASH_ATTR char* sha256_end ( sha256_ctx_t context,
char  buffer[SHA256_DIGEST_STRING_LENGTH] 
)

Definition at line 399 of file sha256.c.

References ICACHE_FLASH_ATTR, memset, SHA256_DIGEST_LENGTH, sha256_final(), and sha2_hex_digits.

Referenced by sha256_data().

399  {
400  uint8_t digest[SHA256_DIGEST_LENGTH];
401  uint8_t *d = digest;
402  int i;
403 
404  if (buffer != (char*)0) {
405  sha256_final(context, digest);
406 
407  for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
408  *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
409  *buffer++ = sha2_hex_digits[*d & 0x0f];
410  d++;
411  }
412  *buffer = (char)0;
413  } else {
414  memset(context, 0, sizeof(sha256_ctx_t));
415  }
416  memset(digest, 0, SHA256_DIGEST_LENGTH);
417  return buffer;
418 }
#define memset(x, a, b)
Definition: platform.h:21
ICACHE_FLASH_ATTR void sha256_final(sha256_ctx_t *context, uint8_t digest[SHA256_DIGEST_LENGTH])
Definition: sha256.c:334
static const char * sha2_hex_digits
Definition: sha256.c:191
#define SHA256_DIGEST_LENGTH
Definition: sha256.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha256_final()

ICACHE_FLASH_ATTR void sha256_final ( sha256_ctx_t context,
uint8_t  digest[SHA256_DIGEST_LENGTH] 
)

Definition at line 334 of file sha256.c.

References sha256_ctx_t::bitcount, sha256_ctx_t::buffer, ICACHE_FLASH_ATTR, memcpy, memset, REVERSE32, REVERSE64, SHA256_BLOCK_LENGTH, SHA256_SHORT_BLOCK_LENGTH, sha256_transform(), and sha256_ctx_t::state.

Referenced by hmac_sha256_final(), sha256_end(), and sha256_raw().

334  {
335  unsigned int usedspace;
336 
337  /* If no digest buffer is passed, we don't bother doing this: */
338  if (digest != (uint8_t*)0) {
339  usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
340 #if BYTE_ORDER == LITTLE_ENDIAN
341  /* Convert FROM host byte order */
342  REVERSE64(context->bitcount,context->bitcount);
343 #endif
344  if (usedspace > 0) {
345  /* Begin padding with a 1 bit: */
346  context->buffer[usedspace++] = 0x80;
347 
348  if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
349  /* Set-up for the last transform: */
350  memset(&context->buffer[usedspace], 0, SHA256_SHORT_BLOCK_LENGTH - usedspace);
351  } else {
352  if (usedspace < SHA256_BLOCK_LENGTH) {
353  memset(&context->buffer[usedspace], 0, SHA256_BLOCK_LENGTH - usedspace);
354  }
355  /* Do second-to-last transform: */
356  sha256_transform(context, context->buffer);
357 
358  /* And set-up for the last transform: */
360  }
361  } else {
362  /* Set-up for the last transform: */
364 
365  /* Begin padding with a 1 bit: */
366  *context->buffer = 0x80;
367  }
368  /* Set the bit count: */
369  uint64_t *t = (uint64_t *)(void*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH];
370  *t = context->bitcount;
371 
372  /* Final transform: */
373  sha256_transform(context, context->buffer);
374 
375 #if BYTE_ORDER == LITTLE_ENDIAN
376  {
377  /* Convert TO host byte order */
378  int j;
379  for (j = 0; j < 8; j++) {
380  REVERSE32(context->state[j],context->state[j]);
381  digest[0] = ((context->state[j] >> 0) & 0xff);
382  digest[1] = ((context->state[j] >> 8) & 0xff);
383  digest[2] = ((context->state[j] >> 16) & 0xff);
384  digest[3] = ((context->state[j] >> 24) & 0xff);
385  digest += sizeof(uint32_t);
386  }
387  }
388 #else
389  memcpy(d, context->state, SHA256_DIGEST_LENGTH);
390 #endif
391  }
392 
393  /* Clean up state data: */
394  memset(context, 0, sizeof(sha256_ctx_t));
395  usedspace = 0;
396 }
#define memset(x, a, b)
Definition: platform.h:21
#define REVERSE32(w, x)
Definition: sha256.c:87
#define SHA256_SHORT_BLOCK_LENGTH
Definition: sha256.c:82
#define SHA256_BLOCK_LENGTH
Definition: sha256.h:38
uint32_t state[8]
Definition: sha256.h:43
uint64_t bitcount
Definition: sha256.h:44
uint8_t buffer[SHA256_BLOCK_LENGTH]
Definition: sha256.h:45
#define memcpy(x, a, b)
Definition: platform.h:22
void sha256_transform(sha256_ctx_t *, uint8_t *)
Definition: sha256.c:206
#define REVERSE64(w, x)
Definition: sha256.c:92
#define SHA256_DIGEST_LENGTH
Definition: sha256.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha256_init()

ICACHE_FLASH_ATTR void sha256_init ( sha256_ctx_t context)

Definition at line 196 of file sha256.c.

References sha256_ctx_t::bitcount, sha256_ctx_t::buffer, ICACHE_FLASH_ATTR, memcpy, memset, SHA256_BLOCK_LENGTH, SHA256_DIGEST_LENGTH, sha256_initial_hash_value, and sha256_ctx_t::state.

Referenced by hmac_sha256_final(), hmac_sha256_init(), sha256_data(), and sha256_raw().

196  {
197  if (context == (sha256_ctx_t*)0) {
198  return;
199  }
201  memset(context->buffer, 0, SHA256_BLOCK_LENGTH);
202  context->bitcount = 0;
203 }
#define memset(x, a, b)
Definition: platform.h:21
#define SHA256_BLOCK_LENGTH
Definition: sha256.h:38
uint32_t state[8]
Definition: sha256.h:43
uint64_t bitcount
Definition: sha256.h:44
uint8_t buffer[SHA256_BLOCK_LENGTH]
Definition: sha256.h:45
static const uint32_t sha256_initial_hash_value[8]
Definition: sha256.c:176
#define memcpy(x, a, b)
Definition: platform.h:22
#define SHA256_DIGEST_LENGTH
Definition: sha256.h:39
Here is the caller graph for this function:

◆ sha256_raw()

ICACHE_FLASH_ATTR void sha256_raw ( uint8_t *  data,
size_t  len,
uint8_t  digest[SHA256_DIGEST_LENGTH] 
)

Definition at line 421 of file sha256.c.

References ICACHE_FLASH_ATTR, sha256_final(), sha256_init(), and sha256_update().

Referenced by hmac_sha256_init(), and init_aes_hmac_combined().

421  {
422  sha256_ctx_t context;
423 
424  sha256_init(&context);
425  sha256_update(&context, data, len);
426  sha256_final(&context, digest);
427 }
ICACHE_FLASH_ATTR void sha256_final(sha256_ctx_t *context, uint8_t digest[SHA256_DIGEST_LENGTH])
Definition: sha256.c:334
ICACHE_FLASH_ATTR void sha256_init(sha256_ctx_t *context)
Definition: sha256.c:196
ICACHE_FLASH_ATTR void sha256_update(sha256_ctx_t *context, uint8_t *data, size_t len)
Definition: sha256.c:288
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha256_transform()

ICACHE_FLASH_ATTR void sha256_transform ( sha256_ctx_t context,
uint8_t *  data 
)

Definition at line 206 of file sha256.c.

References sha256_ctx_t::buffer, Ch, ICACHE_FLASH_ATTR, K256, Maj, Sigma0_256, sigma0_256, Sigma1_256, sigma1_256, and sha256_ctx_t::state.

Referenced by sha256_final(), and sha256_update().

206  {
207  uint32_t a, b, c, d, e, f, g, h, s0, s1;
208  uint32_t T1, T2, *W256;
209  int j;
210 
211  W256 = (uint32_t*)(void*)context->buffer;
212 
213  /* Initialize registers with the prev. intermediate value */
214  a = context->state[0];
215  b = context->state[1];
216  c = context->state[2];
217  d = context->state[3];
218  e = context->state[4];
219  f = context->state[5];
220  g = context->state[6];
221  h = context->state[7];
222 
223  j = 0;
224  do {
225 #if BYTE_ORDER == LITTLE_ENDIAN
226  /* Copy data while converting to host byte order */
227  uint32_t u32;
228  u32 = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
229  W256[j] = u32;
230  // REVERSE32(u32, W256[j]);
231  data += sizeof(uint32_t);
232  /* Apply the SHA-256 compression function to update a..h */
233  T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
234 #else /* BYTE_ORDER == LITTLE_ENDIAN */
235  /* Apply the SHA-256 compression function to update a..h with copy */
236  T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
237 #endif /* BYTE_ORDER == LITTLE_ENDIAN */
238  T2 = Sigma0_256(a) + Maj(a, b, c);
239  h = g;
240  g = f;
241  f = e;
242  e = d + T1;
243  d = c;
244  c = b;
245  b = a;
246  a = T1 + T2;
247  j++;
248  } while (j < 16);
249 
250  do {
251  /* Part of the message block expansion: */
252  s0 = W256[(j+1)&0x0f];
253  s0 = sigma0_256(s0);
254  s1 = W256[(j+14)&0x0f];
255  s1 = sigma1_256(s1);
256 
257  /* Apply the SHA-256 compression function to update a..h */
258  T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
259  (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
260  T2 = Sigma0_256(a) + Maj(a, b, c);
261  h = g;
262  g = f;
263  f = e;
264  e = d + T1;
265  d = c;
266  c = b;
267  b = a;
268  a = T1 + T2;
269 
270  j++;
271  } while (j < 64);
272 
273  /* Compute the current intermediate hash value */
274  context->state[0] += a;
275  context->state[1] += b;
276  context->state[2] += c;
277  context->state[3] += d;
278  context->state[4] += e;
279  context->state[5] += f;
280  context->state[6] += g;
281  context->state[7] += h;
282 
283  /* Clean up */
284  a = b = c = d = e = f = g = h = T1 = T2 = 0;
285 }
#define sigma1_256(x)
Definition: sha256.c:138
#define sigma0_256(x)
Definition: sha256.c:137
#define Ch(x, y, z)
Definition: sha256.c:131
uint32_t state[8]
Definition: sha256.h:43
unsigned int u32
Definition: c_types.h:56
uint8_t buffer[SHA256_BLOCK_LENGTH]
Definition: sha256.h:45
#define Sigma1_256(x)
Definition: sha256.c:136
#define Sigma0_256(x)
Definition: sha256.c:135
#define Maj(x, y, z)
Definition: sha256.c:132
static const uint32_t K256[64]
Definition: sha256.c:156
Here is the caller graph for this function:

◆ sha256_update()

ICACHE_FLASH_ATTR void sha256_update ( sha256_ctx_t context,
uint8_t *  data,
size_t  len 
)

Definition at line 288 of file sha256.c.

References sha256_ctx_t::bitcount, sha256_ctx_t::buffer, ICACHE_FLASH_ATTR, memcpy, SHA256_BLOCK_LENGTH, and sha256_transform().

Referenced by hmac_sha256_final(), hmac_sha256_init(), hmac_sha256_update(), sha256_data(), and sha256_raw().

288  {
289  unsigned int freespace, usedspace;
290 
291  if (len == 0) {
292  // Calling with no data is valid - we do nothing
293  return;
294  }
295 
296  usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
297  if (usedspace > 0) {
298  // Calculate how much free space is available in the buffer
299  freespace = SHA256_BLOCK_LENGTH - usedspace;
300 
301  if (len >= freespace) {
302  // Fill the buffer completely and process it
303  memcpy(&context->buffer[usedspace], data, freespace);
304  context->bitcount += freespace << 3;
305  len -= freespace;
306  data += freespace;
307  sha256_transform(context, context->buffer);
308  } else {
309  // The buffer is not yet full
310  memcpy(&context->buffer[usedspace], data, len);
311  context->bitcount += len << 3;
312  // Clean up:
313  usedspace = freespace = 0;
314  return;
315  }
316  }
317  while (len >= SHA256_BLOCK_LENGTH) {
318  // Process as many complete blocks as we can
319  sha256_transform(context, data);
320  context->bitcount += SHA256_BLOCK_LENGTH << 3;
321  len -= SHA256_BLOCK_LENGTH;
322  data += SHA256_BLOCK_LENGTH;
323  }
324  if (len > 0) {
325  // There's left-overs, so save 'em
326  memcpy(context->buffer, data, len);
327  context->bitcount += len << 3;
328  }
329  // Clean up:
330  usedspace = freespace = 0;
331 }
#define SHA256_BLOCK_LENGTH
Definition: sha256.h:38
uint64_t bitcount
Definition: sha256.h:44
uint8_t buffer[SHA256_BLOCK_LENGTH]
Definition: sha256.h:45
#define memcpy(x, a, b)
Definition: platform.h:22
void sha256_transform(sha256_ctx_t *, uint8_t *)
Definition: sha256.c:206
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ K256

const uint32_t K256[64]
static
Initial value:
= {
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
}

Definition at line 156 of file sha256.c.

Referenced by sha256_transform().

◆ sha256_initial_hash_value

const uint32_t sha256_initial_hash_value[8]
static
Initial value:
= {
0x6a09e667UL,
0xbb67ae85UL,
0x3c6ef372UL,
0xa54ff53aUL,
0x510e527fUL,
0x9b05688cUL,
0x1f83d9abUL,
0x5be0cd19UL
}

Definition at line 176 of file sha256.c.

Referenced by sha256_init().

◆ sha2_hex_digits

const char* sha2_hex_digits = "0123456789abcdef"
static

Definition at line 191 of file sha256.c.

Referenced by sha256_end().