Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

beecrypt/sha1.c File Reference

SHA-1 hash function, code. More...

#include "system.h"
#include "beecrypt.h"
#include "sha1opt.h"
#include "sha1.h"
#include "mp32.h"
#include "endianness.h"
#include "debug.h"

Go to the source code of this file.

Defines

#define SUBROUND1(a, b, c, d, e, w, k)
#define SUBROUND2(a, b, c, d, e, w, k)
#define SUBROUND3(a, b, c, d, e, w, k)
#define SUBROUND4(a, b, c, d, e, w, k)

Functions

int sha1Reset (register sha1Param *p)
void sha1Process (register sha1Param *p)
int sha1Update (register sha1Param *p, const byte *data, int size)
void sha1Finish (register sha1Param *p)
int sha1Digest (register sha1Param *p, uint32 *data)

Variables

const uint32 k [4] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 }
const uint32 hinit [5] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 }
const hashFunction sha1 = { "SHA-1", sizeof(sha1Param), 64, 5 * sizeof(uint32), (hashFunctionReset) sha1Reset, (hashFunctionUpdate) sha1Update, (hashFunctionDigest) sha1Digest }


Detailed Description

SHA-1 hash function, code.

For more information on this algorithm, see: NIST FIPS PUB 180-1

Definition in file sha1.c.


Define Documentation

#define SUBROUND1 (  a,
b,
c,
d,
e,
w,
k    ) 
 

Value:

e = ROTL32(a, 5) + ((b&(c^d))^d) + e + w + k;   \
        b = ROTR32(b, 2)

Definition at line 64 of file sha1.c.

Referenced by sha1Process.

#define SUBROUND2 (  a,
b,
c,
d,
e,
w,
k    ) 
 

Value:

e = ROTL32(a, 5) + (b^c^d) + e + w + k; \
        b = ROTR32(b, 2)

Definition at line 67 of file sha1.c.

Referenced by sha1Process.

#define SUBROUND3 (  a,
b,
c,
d,
e,
w,
k    ) 
 

Value:

e = ROTL32(a, 5) + (((b|c)&d)|(b&c)) + e + w + k;       \
        b = ROTR32(b, 2)

Definition at line 70 of file sha1.c.

Referenced by sha1Process.

#define SUBROUND4 (  a,
b,
c,
d,
e,
w,
k    ) 
 

Value:

e = ROTL32(a, 5) + (b^c^d) + e + w + k; \
        b = ROTR32(b, 2)

Definition at line 73 of file sha1.c.

Referenced by sha1Process.


Function Documentation

int sha1Digest (  register sha1Param *    p,
uint32 *    data
) 
 

Definition at line 262 of file sha1.c.

References mp32copy, sha1Finish, sha1Reset, and uint32.

void sha1Process (  register sha1Param *    p ) 
 

Definition at line 79 of file sha1.c.

References k, ROTL32, SUBROUND1, SUBROUND2, SUBROUND3, SUBROUND4, swapu32, and uint32.

int sha1Reset (  register sha1Param *    p ) 
 

Definition at line 54 of file sha1.c.

References hinit, mp32copy, and mp32zero.

int sha1Update (  register sha1Param *    p,
const byte *    data,
int    size
) 
 

Definition at line 202 of file sha1.c.

References sha1Process.


Generated on Wed Sep 4 12:49:59 2002 for rpm by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002