WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
sha256.c 文件参考
#include "securec.h"
#include "sha256/sha256.h"
sha256.c 的引用(Include)关系图:

宏定义

#define rotl(x, n)   (((x) << (n)) | ((x) >> (32 - (n))))
 
#define rotr(x, n)   (((x) >> (n)) | ((x) << (32 - (n))))
 
#define ch(x, y, z)   ((z) ^ ((x) & ((y) ^ (z))))
 
#define maj(x, y, z)   (((x) & ((y) | (z))) | ((y) & (z)))
 
#define sigma_0(x)   (rotr((x), 2) ^ rotr((x), 13) ^ rotr((x), 22))
 
#define sigma_1(x)   (rotr((x), 6) ^ rotr((x), 11) ^ rotr((x), 25))
 
#define sigma0(x)   (rotr((x), 7) ^ rotr((x), 18) ^ ((x) >> 3))
 
#define sigma1(x)   (rotr((x), 17) ^ rotr((x), 19) ^ ((x) >> 10))
 
#define K_ARRAY_LEN   64
 
#define PADDING_ARRAY_LEN   64
 
#define H_SWAP_L_SHIFT   32
 
#define SHA256GUTS_BUF_LEN   64
 
#define BURNSTACK_BUF_LEN   128
 
#define SHIFT_15_8_WORD   8
 
#define SHIFT_23_16_WORD   16
 
#define SHIFT_31_24_WORD   24
 
#define SHA256_UNROLL_1   1
 
#define SHA256_UNROLL_2   2
 
#define SHA256_UNROLL_4   4
 
#define SHA256_UNROLL_8   8
 
#define SHA256_UNROLL_16   16
 
#define SHA256_UNROLL_32   32
 
#define SHA256_UNROLL_64   64
 
#define SC_HASH_INDEX2   2
 
#define SC_HASH_INDEX3   3
 
#define SC_HASH_INDEX4   4
 
#define SC_HASH_INDEX5   5
 
#define SC_HASH_INDEX6   6
 
#define SC_HASH_INDEX7   7
 
#define BUF_INDEX1   9
 
#define BUF_INDEX2   14
 
#define BURN_PARAMETER_INDEX1   74
 
#define BURN_PARAMETER_INDEX2   6
 
#define do_round()
 
#define byte_swap(x)   ((rotr((x), 8) & 0xff00ff00L) | (rotl((x), 8) & 0x00ff00ffL))
 
#define byte_swap_64(x)   _byteswap64(x)
 
#define SHA256_UNROLL   1
 

函数

void sha256_init (sha256_context_t *sc)
 
void SHA256Update (sha256_context_t *sc, const void *vdata, uint32_t len)
 
void sha256_final (sha256_context_t *sc, uint8_t hash[SHA256_HASH_SIZE], uint32_t hash_len)
 
void sha256_hash (const uint8_t *in_buff, uint32_t in_buff_len, uint8_t *out_buff, uint32_t out_buff_len)
 

宏定义说明

◆ BUF_INDEX1

#define BUF_INDEX1   9

◆ BUF_INDEX2

#define BUF_INDEX2   14

◆ BURN_PARAMETER_INDEX1

#define BURN_PARAMETER_INDEX1   74

◆ BURN_PARAMETER_INDEX2

#define BURN_PARAMETER_INDEX2   6

◆ BURNSTACK_BUF_LEN

#define BURNSTACK_BUF_LEN   128

◆ byte_swap

#define byte_swap (   x)    ((rotr((x), 8) & 0xff00ff00L) | (rotl((x), 8) & 0x00ff00ffL))

◆ byte_swap_64

#define byte_swap_64 (   x)    _byteswap64(x)

◆ ch

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

◆ do_round

#define do_round ( )
值:
do { \
t1 = h + sigma_1(e) + ch(e, f, g) + *(kp++) + *(w++); \
t2 = sigma_0(a) + maj(a, b, c); \
h = g, g = f, f = e; \
e = d + t1; \
d = c; \
c = b; \
b = a; \
a = t1 + t2; \
} while (0)
#define ch(x, y, z)
Definition sha256.c:18
#define sigma_1(x)
Definition sha256.c:21
#define maj(x, y, z)
Definition sha256.c:19
#define sigma_0(x)
Definition sha256.c:20

◆ H_SWAP_L_SHIFT

#define H_SWAP_L_SHIFT   32

◆ K_ARRAY_LEN

#define K_ARRAY_LEN   64

◆ maj

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

◆ PADDING_ARRAY_LEN

#define PADDING_ARRAY_LEN   64

◆ rotl

#define rotl (   x,
 
)    (((x) << (n)) | ((x) >> (32 - (n))))

◆ rotr

#define rotr (   x,
 
)    (((x) >> (n)) | ((x) << (32 - (n))))

◆ SC_HASH_INDEX2

#define SC_HASH_INDEX2   2

◆ SC_HASH_INDEX3

#define SC_HASH_INDEX3   3

◆ SC_HASH_INDEX4

#define SC_HASH_INDEX4   4

◆ SC_HASH_INDEX5

#define SC_HASH_INDEX5   5

◆ SC_HASH_INDEX6

#define SC_HASH_INDEX6   6

◆ SC_HASH_INDEX7

#define SC_HASH_INDEX7   7

◆ SHA256_UNROLL

#define SHA256_UNROLL   1

◆ SHA256_UNROLL_1

#define SHA256_UNROLL_1   1

◆ SHA256_UNROLL_16

#define SHA256_UNROLL_16   16

◆ SHA256_UNROLL_2

#define SHA256_UNROLL_2   2

◆ SHA256_UNROLL_32

#define SHA256_UNROLL_32   32

◆ SHA256_UNROLL_4

#define SHA256_UNROLL_4   4

◆ SHA256_UNROLL_64

#define SHA256_UNROLL_64   64

◆ SHA256_UNROLL_8

#define SHA256_UNROLL_8   8

◆ SHA256GUTS_BUF_LEN

#define SHA256GUTS_BUF_LEN   64

◆ SHIFT_15_8_WORD

#define SHIFT_15_8_WORD   8

◆ SHIFT_23_16_WORD

#define SHIFT_23_16_WORD   16

◆ SHIFT_31_24_WORD

#define SHIFT_31_24_WORD   24

◆ sigma0

#define sigma0 (   x)    (rotr((x), 7) ^ rotr((x), 18) ^ ((x) >> 3))

◆ sigma1

#define sigma1 (   x)    (rotr((x), 17) ^ rotr((x), 19) ^ ((x) >> 10))

◆ sigma_0

#define sigma_0 (   x)    (rotr((x), 2) ^ rotr((x), 13) ^ rotr((x), 22))

◆ sigma_1

#define sigma_1 (   x)    (rotr((x), 6) ^ rotr((x), 11) ^ rotr((x), 25))

函数说明

◆ sha256_final()

void sha256_final ( sha256_context_t sc,
uint8_t  hash[SHA256_HASH_SIZE],
uint32_t  hash_len 
)

◆ sha256_hash()

void sha256_hash ( const uint8_t *  in_buff,
uint32_t  in_buff_len,
uint8_t *  out_buff,
uint32_t  out_buff_len 
)

◆ sha256_init()

void sha256_init ( sha256_context_t sc)

◆ SHA256Update()

void SHA256Update ( sha256_context_t sc,
const void *  vdata,
uint32_t  len 
)