#include <string.h>
#include <stdlib.h>
#include "sha1.h"
Include dependency graph for sha1.c:
Defines | |
#define | BRG_LITTLE_ENDIAN 1234 |
#define | BRG_BIG_ENDIAN 4321 |
#define | PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN |
#define | rotl32(x, n) (((x) << n) | ((x) >> (32 - n))) |
#define | rotr32(x, n) (((x) >> n) | ((x) << (32 - n))) |
#define | bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) |
#define | SWAP_BYTES |
#define | bsw_32(p, n) { int _i = (n); while(_i--) ((sha1_32t*)p)[_i] = bswap_32(((sha1_32t*)p)[_i]); } |
#define | SHA1_MASK (SHA1_BLOCK_SIZE - 1) |
#define | ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) |
#define | parity(x, y, z) ((x) ^ (y) ^ (z)) |
#define | maj(x, y, z) (((x) & (y)) | ((z) & ((x) ^ (y)))) |
#define | q(v, n) v##n |
#define | one_cycle(v, a, b, c, d, e, f, k, h) |
#define | five_cycle(v, f, k, i) |
#define | hf(i) w[i] |
#define | hf(i) |
Functions | |
void | sha1_compile (sha1_ctx ctx[1]) |
void | sha1_begin (sha1_ctx ctx[1]) |
void | sha1_hash (const unsigned char data[], unsigned long len, sha1_ctx ctx[1]) |
void | sha1_end (unsigned char hval[], sha1_ctx ctx[1]) |
void | sha1 (unsigned char hval[], const unsigned char data[], unsigned long len) |
|
|
|
|
|
|
|
|
|
|
|
Value: |
|
Value: (w[(i) & 15] = rotl32( \ w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \ ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1)) |
|
|
|
|
|
Value: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|