Macros | Functions
SHA256.cpp File Reference
#include <cstring>
#include <cassert>
#include "SHA256.h"
Include dependency graph for SHA256.cpp:

Go to the source code of this file.

Macros

#define Ch(x, y, z)   (z ^ (x & (y ^ z)))
 
#define Gamma0(x)   (S(x, 7) ^ S(x, 18) ^ R(x, 3))
 
#define Gamma1(x)   (S(x, 17) ^ S(x, 19) ^ R(x, 10))
 
#define LOAD32H(x, y)
 
#define Maj(x, y, z)   (((x | y) & z) | (x & y))
 
#define MIN(x, y)   ( ((x)<(y))?(x):(y) )
 
#define R(x, n)   (((x)&0xFFFFFFFFUL)>>(n))
 
#define RND(a, b, c, d, e, f, g, h, i, ki)
 
#define RORc(x, y)   ( ((((ulong32)(x)&0xFFFFFFFFUL)>>(ulong32)((y)&31)) | ((ulong32)(x)<<(ulong32)(32-((y)&31)))) & 0xFFFFFFFFUL)
 
#define S(x, n)   RORc((x),(n))
 
#define Sigma0(x)   (S(x, 2) ^ S(x, 13) ^ S(x, 22))
 
#define Sigma1(x)   (S(x, 6) ^ S(x, 11) ^ S(x, 25))
 
#define STORE32H(x, y)
 
#define STORE64H(x, y)
 
#define XMEMCMP   memcmp
 
#define XMEMCPY   memcpy
 

Functions

static int sha256_compress (hash_state *md, const unsigned char *buf)
 
int sha256_done (hash_state *md, unsigned char *out)
 
int sha256_init (hash_state *md)
 
int sha256_process (hash_state *md, const ulong8 *in, ulong32 inlen)
 

Macro Definition Documentation

◆ Ch

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

Definition at line 47 of file SHA256.cpp.

◆ Gamma0

#define Gamma0 (   x)    (S(x, 7) ^ S(x, 18) ^ R(x, 3))

Definition at line 53 of file SHA256.cpp.

◆ Gamma1

#define Gamma1 (   x)    (S(x, 17) ^ S(x, 19) ^ R(x, 10))

Definition at line 54 of file SHA256.cpp.

◆ LOAD32H

#define LOAD32H (   x,
 
)
Value:
{ x = ((ulong32)((y)[0] & 255)<<24) | \
((ulong32)((y)[1] & 255)<<16) | \
((ulong32)((y)[2] & 255)<<8) | \
((ulong32)((y)[3] & 255)); }

Definition at line 19 of file SHA256.cpp.

◆ Maj

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

Definition at line 48 of file SHA256.cpp.

◆ MIN

#define MIN (   x,
 
)    ( ((x)<(y))?(x):(y) )

Definition at line 40 of file SHA256.cpp.

◆ R

#define R (   x,
 
)    (((x)&0xFFFFFFFFUL)>>(n))

Definition at line 50 of file SHA256.cpp.

◆ RND

#define RND (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  ki 
)
Value:
t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \
t1 = Sigma0(a) + Maj(a, b, c); \
d += t0; \
h = t0 + t1;

◆ RORc

#define RORc (   x,
 
)    ( ((((ulong32)(x)&0xFFFFFFFFUL)>>(ulong32)((y)&31)) | ((ulong32)(x)<<(ulong32)(32-((y)&31)))) & 0xFFFFFFFFUL)

Definition at line 44 of file SHA256.cpp.

◆ S

#define S (   x,
 
)    RORc((x),(n))

Definition at line 49 of file SHA256.cpp.

◆ Sigma0

#define Sigma0 (   x)    (S(x, 2) ^ S(x, 13) ^ S(x, 22))

Definition at line 51 of file SHA256.cpp.

◆ Sigma1

#define Sigma1 (   x)    (S(x, 6) ^ S(x, 11) ^ S(x, 25))

Definition at line 52 of file SHA256.cpp.

◆ STORE32H

#define STORE32H (   x,
 
)
Value:
{ (y)[0] = (ulong8)(((x)>>24)&255); (y)[1] = (ulong8)(((x)>>16)&255); \
(y)[2] = (ulong8)(((x)>>8)&255); (y)[3] = (ulong8)((x)&255); }

Definition at line 25 of file SHA256.cpp.

◆ STORE64H

#define STORE64H (   x,
 
)
Value:
{ (y)[0] = (ulong8)(((x)>>56)&255); (y)[1] = (ulong8)(((x)>>48)&255); \
(y)[2] = (ulong8)(((x)>>40)&255); (y)[3] = (ulong8)(((x)>>32)&255); \
(y)[4] = (ulong8)(((x)>>24)&255); (y)[5] = (ulong8)(((x)>>16)&255); \
(y)[6] = (ulong8)(((x)>>8)&255); (y)[7] = (ulong8)((x)&255); }

Definition at line 29 of file SHA256.cpp.

◆ XMEMCMP

#define XMEMCMP   memcmp

Definition at line 37 of file SHA256.cpp.

◆ XMEMCPY

#define XMEMCPY   memcpy

Definition at line 35 of file SHA256.cpp.

Function Documentation

◆ sha256_compress()

static int sha256_compress ( hash_state md,
const unsigned char *  buf 
)
static

Definition at line 56 of file SHA256.cpp.

◆ sha256_done()

int sha256_done ( hash_state md,
unsigned char *  out 
)

Terminate the hash to get the digest

Parameters
mdThe hash state
out[out] The destination of the hash (32 bytes)
Returns
CRYPT_OK if successful

Definition at line 249 of file SHA256.cpp.

◆ sha256_init()

int sha256_init ( hash_state md)

Initialize the hash state

Parameters
mdThe hash state you wish to initialize
Returns
CRYPT_OK if successful

Definition at line 163 of file SHA256.cpp.

◆ sha256_process()

int sha256_process ( hash_state md,
const ulong8 in,
ulong32  inlen 
)

Process a block of memory though the hash

Parameters
mdThe hash state
inThe data to hash
inlenThe length of the data (octets)
Returns
CRYPT_OK if successful Process a block of memory though the hash
Parameters
mdThe hash state
inThe data to hash
inlenThe length of the data (octets)
Returns
CRYPT_OK if successful

Definition at line 195 of file SHA256.cpp.

Sigma1
#define Sigma1(x)
Definition: SHA256.cpp:52
ulong32
uint32_t ulong32
Definition: SHA256.h:15
Sigma0
#define Sigma0(x)
Definition: SHA256.cpp:51
ulong8
uint8_t ulong8
Definition: SHA256.h:14
Maj
#define Maj(x, y, z)
Definition: SHA256.cpp:48
boost::iterators::i
D const & i
Definition: iterator_facade.hpp:956
Ch
#define Ch(x, y, z)
Definition: SHA256.cpp:47


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:56:21