|
XenevaOS
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include "i_swap.h"#include "sha1.h"
Macros | |
| #define | K1 0x5A827999L |
| #define | K2 0x6ED9EBA1L |
| #define | K3 0x8F1BBCDCL |
| #define | K4 0xCA62C1D6L |
| #define | F1(x, y, z) ( z ^ ( x & ( y ^ z ) ) ) |
| #define | F2(x, y, z) ( x ^ y ^ z ) |
| #define | F3(x, y, z) ( ( x & y ) | ( z & ( x | y ) ) ) |
| #define | F4(x, y, z) ( x ^ y ^ z ) |
| #define | rol(x, n) ( ((x) << (n)) | ((x) >> (32-(n))) ) |
| #define | M(i) |
| #define | R(a, b, c, d, e, f, k, m) |
| #define | X(a) |
Functions | |
| void | SHA1_Init (sha1_context_t *hd) |
| void | SHA1_Update (sha1_context_t *hd, byte *inbuf, size_t inlen) |
| void | SHA1_Final (sha1_digest_t digest, sha1_context_t *hd) |
| void | SHA1_UpdateInt32 (sha1_context_t *context, unsigned int val) |
| void | SHA1_UpdateString (sha1_context_t *context, char *str) |
| #define F1 | ( | x, | |
| y, | |||
| z | |||
| ) | ( z ^ ( x & ( y ^ z ) ) ) |
| #define F2 | ( | x, | |
| y, | |||
| z | |||
| ) | ( x ^ y ^ z ) |
| #define F3 | ( | x, | |
| y, | |||
| z | |||
| ) | ( ( x & y ) | ( z & ( x | y ) ) ) |
| #define F4 | ( | x, | |
| y, | |||
| z | |||
| ) | ( x ^ y ^ z ) |
| #define K1 0x5A827999L |
| #define K2 0x6ED9EBA1L |
| #define K3 0x8F1BBCDCL |
| #define K4 0xCA62C1D6L |
| #define M | ( | i | ) |
| #define rol | ( | x, | |
| n | |||
| ) | ( ((x) << (n)) | ((x) >> (32-(n))) ) |
| #define X | ( | a | ) |
| void SHA1_Final | ( | sha1_digest_t | digest, |
| sha1_context_t * | hd | ||
| ) |
| void SHA1_Init | ( | sha1_context_t * | hd | ) |
| void SHA1_Update | ( | sha1_context_t * | hd, |
| byte * | inbuf, | ||
| size_t | inlen | ||
| ) |
| void SHA1_UpdateInt32 | ( | sha1_context_t * | context, |
| unsigned int | val | ||
| ) |
| void SHA1_UpdateString | ( | sha1_context_t * | context, |
| char * | str | ||
| ) |