#include <string.h>
#include "sha1.h"
Defines | |
#define | SHA1HANDSOFF |
#define | BYTE_ORDER_BIG_ENDIAN |
#define | rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) |
#define | blk0(i) block->l[i] |
#define | blk(i) |
#define | R0(v, w, x, y, z, i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); |
#define | R1(v, w, x, y, z, i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); |
#define | R2(v, w, x, y, z, i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); |
#define | R3(v, w, x, y, z, i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); |
#define | R4(v, w, x, y, z, i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); |
Functions | |
void | Sha1::SHA1Transform (unsigned long state[5], unsigned char buffer[64]) |
void | Sha1::SHA1_Init (SHA1_CTX *context) |
void | Sha1::SHA1_Update (SHA1_CTX *context, unsigned char *data, unsigned int len) |
void | Sha1::SHA1_Final (unsigned char digest[20], SHA1_CTX *context) |
#define blk | ( | i | ) |
Value:
(block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ ^block->l[(i+2)&15]^block->l[i&15],1))
#define blk0 | ( | i | ) | block->l[i] |
#define BYTE_ORDER_BIG_ENDIAN |
#define R0 | ( | v, | |||
w, | |||||
x, | |||||
y, | |||||
z, | |||||
i | ) | z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); |
#define R1 | ( | v, | |||
w, | |||||
x, | |||||
y, | |||||
z, | |||||
i | ) | z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); |
#define R2 | ( | v, | |||
w, | |||||
x, | |||||
y, | |||||
z, | |||||
i | ) | z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); |
#define R3 | ( | v, | |||
w, | |||||
x, | |||||
y, | |||||
z, | |||||
i | ) | z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); |
#define R4 | ( | v, | |||
w, | |||||
x, | |||||
y, | |||||
z, | |||||
i | ) | z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); |
#define rol | ( | value, | |||
bits | ) | (((value) << (bits)) | ((value) >> (32 - (bits)))) |
#define SHA1HANDSOFF |