sha1.C File Reference

#include "Util/sha1.H"
#include <string.h>
Include dependency graph for sha1.C:

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

Typedefs

typedef byte uint8

Functions

void sha1_starts (sha1_context *ctx)
void sha1_process (sha1_context *ctx, const uint8 data[64])
void sha1_update (sha1_context *ctx, const uint8 *input, uint32 length)
void sha1_finish (sha1_context *ctx, uint8 digest[20])

Variables

static uint8 sha1_padding [64]

Detailed Description

general sha1 (160-bit) message-digest implementation

Definition in file sha1.C.


Define Documentation

#define GET_UINT32 ( n,
b,
 ) 
Value:
{                                               \
    (n) = ( (uint32) (b)[(i)    ] << 24 )       \
        | ( (uint32) (b)[(i) + 1] << 16 )       \
        | ( (uint32) (b)[(i) + 2] <<  8 )       \
        | ( (uint32) (b)[(i) + 3]       );      \
}

Definition at line 42 of file sha1.C.

#define P ( a,
b,
c,
d,
e,
 ) 
Value:
{                                                       \
    e += S(a,5) + F(b,c,d) + K + x; b = S(b,30);        \
}
#define PUT_UINT32 ( n,
b,
 ) 
Value:
{                                               \
    (b)[(i)    ] = (uint8) ( (n) >> 24 );       \
    (b)[(i) + 1] = (uint8) ( (n) >> 16 );       \
    (b)[(i) + 2] = (uint8) ( (n) >>  8 );       \
    (b)[(i) + 3] = (uint8) ( (n)       );       \
}

Definition at line 50 of file sha1.C.

#define R (  ) 
Value:
(                                                       \
    temp = W[(t -  3) & 0x0F] ^ W[(t - 8) & 0x0F] ^     \
           W[(t - 14) & 0x0F] ^ W[ t      & 0x0F],      \
    ( W[t & 0x0F] = S(temp,1) )                         \
)

Variable Documentation

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 265 of file sha1.C.

Generated on Sun May 8 08:42:52 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3