sha1.C File Reference

#include <stdio.h>
#include <string.h>
#include "common/h/Types.h"
#include "common/h/sha1.h"

Go to the source code of this file.

Data Structures

struct  SHA1_CTX

Defines

#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))
#define blk0(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 SHA1Transform (uint32_t state[5], unsigned char buffer[64])
void SHA1Init (SHA1_CTX *context)
void SHA1Update (SHA1_CTX *context, unsigned char *data, uint32_t len)
void SHA1Final (unsigned char digest[20], SHA1_CTX *context)
char * sha1_file (const char *filename, char *result_ptr)

Define Documentation

#define blk (  ) 
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))

Definition at line 132 of file sha1.C.

#define blk0 (  ) 
Value:
(block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
    |(rol(block->l[i],8)&0x00FF00FF))

Definition at line 129 of file sha1.C.

#define R0 ( v,
w,
x,
y,
z,
 )     z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 136 of file sha1.C.

Referenced by SHA1Transform().

#define R1 ( v,
w,
x,
y,
z,
 )     z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);

Definition at line 137 of file sha1.C.

Referenced by SHA1Transform().

#define R2 ( v,
w,
x,
y,
z,
 )     z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);

Definition at line 138 of file sha1.C.

Referenced by SHA1Transform().

#define R3 ( v,
w,
x,
y,
z,
 )     z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);

Definition at line 139 of file sha1.C.

Referenced by SHA1Transform().

#define R4 ( v,
w,
x,
y,
z,
 )     z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);

Definition at line 140 of file sha1.C.

Referenced by SHA1Transform().

#define rol ( value,
bits   )     (((value) << (bits)) | ((value) >> (32 - (bits))))

Definition at line 122 of file sha1.C.


Function Documentation

char* sha1_file ( const char *  filename,
char *  result_ptr 
)
void SHA1Final ( unsigned char  digest[20],
SHA1_CTX context 
)

Definition at line 255 of file sha1.C.

References SHA1_CTX::buffer, SHA1_CTX::count, SHA1Transform(), SHA1Update(), and SHA1_CTX::state.

Referenced by sha1_file().

void SHA1Init ( SHA1_CTX context  ) 

Definition at line 213 of file sha1.C.

References SHA1_CTX::count, and SHA1_CTX::state.

Referenced by sha1_file().

void SHA1Transform ( uint32_t  state[5],
unsigned char  buffer[64] 
)

Definition at line 158 of file sha1.C.

References R0, R1, R2, R3, and R4.

Referenced by SHA1Final(), and SHA1Update().

void SHA1Update ( SHA1_CTX context,
unsigned char *  data,
uint32_t  len 
)

Definition at line 227 of file sha1.C.

References SHA1_CTX::buffer, SHA1_CTX::count, SHA1Transform(), and SHA1_CTX::state.

Referenced by sha1_file(), and SHA1Final().

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1