46 ctx->
H[0] = UINT32_C (0x67452301);
47 ctx->
H[1] = UINT32_C (0xefcdab89);
48 ctx->
H[2] = UINT32_C (0x98badcfe);
49 ctx->
H[3] = UINT32_C (0x10325476);
50 ctx->
H[4] = UINT32_C (0xc3d2e1f0);
82#define Ch(x,y,z) ( (z) ^ ((x) & ((y) ^ (z))) )
83#define Maj(x,y,z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) )
87#define Par(x,y,z) ( (x) ^ (y) ^ (z) )
100#define SHA1STEP32(vA,vB,vC,vD,vE,ft,kt,wt) do { \
101 (vE) += _MHD_ROTL32 ((vA), 5) + ft ((vB), (vC), (vD)) + (kt) + (wt); \
102 (vB) = _MHD_ROTL32 ((vB), 30); } while (0)
108#define GET_W_FROM_DATA(buf,t) \
109 _MHD_GET_32BIT_BE (((const uint8_t*) (buf)) + (t) * SHA1_BYTES_IN_WORD)
111#ifndef _MHD_GET_32BIT_BE_UNALIGNED
124#define K00 UINT32_C(0x5a827999)
126#define K20 UINT32_C(0x6ed9eba1)
128#define K40 UINT32_C(0x8f1bbcdc)
130#define K60 UINT32_C(0xca62c1d6)
158#define Wgen(w,t) _MHD_ROTL32((w)[(t + 13) & 0xf] ^ (w)[(t + 8) & 0xf] \
159 ^ (w)[(t + 2) & 0xf] ^ (w)[t & 0xf], 1)
264 ctx->
count += length;
269 if (length >= bytes_left)
272 memcpy (ctx->
buffer + bytes_have,
276 length -= bytes_left;
293 memcpy (ctx->
buffer + bytes_have,
data, length);
302#define SHA1_SIZE_OF_LEN_ADD (64 / 8)
318 num_bits = ctx->
count << 3;
329 ctx->
buffer[bytes_have++] = 0x80;
343 memset (ctx->
buffer + bytes_have, 0,
352#ifndef _MHD_PUT_32BIT_BE_UNALIGNED
377 memset (ctx, 0,
sizeof(
struct sha1_ctx));
#define _MHD_UINT32_ALIGN
macros for bits manipulations
_MHD_static_inline void _MHD_PUT_64BIT_BE_SAFE(void *dst, uint64_t value)
#define _MHD_PUT_32BIT_BE(addr, value32)
void MHD_SHA1_update(void *ctx_, const uint8_t *data, size_t length)
void MHD_SHA1_finish(void *ctx_, uint8_t digest[SHA1_DIGEST_SIZE])
#define SHA1STEP32(vA, vB, vC, vD, vE, ft, kt, wt)
void MHD_SHA1_init(void *ctx_)
#define SHA1_SIZE_OF_LEN_ADD
#define GET_W_FROM_DATA(buf, t)
static void sha1_transform(uint32_t H[_SHA1_DIGEST_LENGTH], const uint8_t data[SHA1_BLOCK_SIZE])
#define _SHA1_DIGEST_LENGTH
#define SHA1_BYTES_IN_WORD
uint32_t H[_SHA1_DIGEST_LENGTH]
uint8_t buffer[SHA1_BLOCK_SIZE]