s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
Macros | Functions
sha1.c File Reference
#include <string.h>
#include "sha1.h"
#include "byte.h"
Include dependency graph for sha1.c:

Go to the source code of this file.

Macros

#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 sha1_transform (uint32_t state[5], const uint8_t buffer[SHA1_BLOCKSIZE])
 
void sha1_init (sha1_ctx *context)
 
void sha1_update (sha1_ctx *context, const uint8_t *data, uint32_t len)
 
void sha1_final (uint8_t digest[SHA1_DIGESTSIZE], sha1_ctx *context)
 
void sha1_hash (char *hash, const char *str, uint32_t len)
 

Macro Definition Documentation

◆ blk

#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 rol(value, bits)
Definition: sha1.c:24

Definition at line 35 of file sha1.c.

◆ blk0

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

Definition at line 30 of file sha1.c.

◆ R0

#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 39 of file sha1.c.

◆ R1

#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 40 of file sha1.c.

◆ R2

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

Definition at line 41 of file sha1.c.

◆ R3

#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 42 of file sha1.c.

◆ R4

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

Definition at line 43 of file sha1.c.

◆ rol

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

Definition at line 24 of file sha1.c.

Function Documentation

◆ sha1_final()

void sha1_final ( uint8_t  digest[SHA1_DIGESTSIZE],
sha1_ctx context 
)

Definition at line 146 of file sha1.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha1_hash()

void sha1_hash ( char *  hash,
const char *  str,
uint32_t  len 
)

Definition at line 177 of file sha1.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha1_init()

void sha1_init ( sha1_ctx context)

Definition at line 111 of file sha1.c.

Here is the caller graph for this function:

◆ sha1_transform()

void sha1_transform ( uint32_t  state[5],
const uint8_t  buffer[SHA1_BLOCKSIZE] 
)

Definition at line 47 of file sha1.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sha1_update()

void sha1_update ( sha1_ctx context,
const uint8_t *  data,
uint32_t  len 
)

Definition at line 124 of file sha1.c.

Here is the call graph for this function:
Here is the caller graph for this function: