#include <string.h>
#include "sha1.h"
Go to the source code of this file.
Defines | |
#define | GET_UINT32(n, b, i) |
#define | PUT_UINT32(n, b, i) |
#define | S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) |
#define | R(t) |
#define | P(a, b, c, d, e, x) |
#define | F(x, y, z) (z ^ (x & (y ^ z))) |
#define | K 0x5A827999 |
#define | F(x, y, z) (x ^ y ^ z) |
#define | K 0x6ED9EBA1 |
#define | F(x, y, z) ((x & y) | (z & (x | y))) |
#define | K 0x8F1BBCDC |
#define | F(x, y, z) (x ^ y ^ z) |
#define | K 0xCA62C1D6 |
Functions | |
void | sha1_starts (sha1_context *ctx) |
void | sha1_process (sha1_context *ctx, uint8 data[64]) |
void | sha1_update (sha1_context *ctx, uint8 *input, uint32 length) |
void | sha1_finish (sha1_context *ctx, uint8 digest[20]) |
Variables | |
static uint8 | sha1_padding [64] |
#define F | ( | x, | |||
y, | |||||
z | ) | (x ^ y ^ z) |
#define F | ( | x, | |||
y, | |||||
z | ) | ((x & y) | (z & (x | y))) |
#define F | ( | x, | |||
y, | |||||
z | ) | (x ^ y ^ z) |
#define F | ( | x, | |||
y, | |||||
z | ) | (z ^ (x & (y ^ z))) |
#define GET_UINT32 | ( | n, | |||
b, | |||||
i | ) |
#define K 0xCA62C1D6 |
#define K 0x8F1BBCDC |
#define K 0x6ED9EBA1 |
#define K 0x5A827999 |
#define P | ( | a, | |||
b, | |||||
c, | |||||
d, | |||||
e, | |||||
x | ) |
#define PUT_UINT32 | ( | n, | |||
b, | |||||
i | ) |
#define R | ( | t | ) |
Value:
( \ temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ ( W[t & 0x0F] = S(temp,1) ) \ )
Referenced by sha1_process().
#define S | ( | x, | |||
n | ) | ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) |
void sha1_finish | ( | sha1_context * | ctx, | |
uint8 | digest[20] | |||
) |
Definition at line 256 of file sha1.cc.
References PUT_UINT32, sha1_padding, sha1_update(), sha1_context::total, uint32, and uint8.
Referenced by hash().
void sha1_process | ( | sha1_context * | ctx, | |
uint8 | data[64] | |||
) |
Definition at line 53 of file sha1.cc.
References GET_UINT32, P, R, sha1_context::state, and uint32.
Referenced by sha1_update().
void sha1_starts | ( | sha1_context * | ctx | ) |
Definition at line 41 of file sha1.cc.
References sha1_context::state, and sha1_context::total.
Referenced by hash().
void sha1_update | ( | sha1_context * | ctx, | |
uint8 * | input, | |||
uint32 | length | |||
) |
Definition at line 209 of file sha1.cc.
References sha1_context::buffer, sha1_process(), sha1_context::total, and uint32.
Referenced by hash(), and sha1_finish().
uint8 sha1_padding[64] [static] |
Initial value:
{ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
Definition at line 248 of file sha1.cc.
Referenced by sha1_finish().