Strophe  0.9
XMPP client library
Macros | Functions
sha1.c File Reference

SHA-1 hash. More...

Macros

#define SHA1HANDSOFF
 
#define rol(value, bits)   (((value) << (bits)) | ((value) >> (32 - (bits))))
 
#define blk0(i)   (block->l[i] = host_to_be(block->l[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);
 
#define le_to_be(i)   ((rol((i),24) & 0xFF00FF00) | (rol((i),8) & 0x00FF00FF))
 

Functions

static uint32_t host_to_be (uint32_t i)
 
static void SHA1_Transform (uint32_t state[5], const uint8_t buffer[64])
 
void crypto_SHA1_Init (SHA1_CTX *context)
 
void crypto_SHA1_Update (SHA1_CTX *context, const uint8_t *data, const size_t len)
 
void crypto_SHA1_Final (SHA1_CTX *context, uint8_t *digest)
 
void crypto_SHA1 (const uint8_t *data, size_t len, uint8_t *digest)
 

Detailed Description

SHA-1 hash.

Macro Definition Documentation

◆ SHA1HANDSOFF

#define SHA1HANDSOFF

◆ rol

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

◆ blk0

#define blk0 (   i)    (block->l[i] = host_to_be(block->l[i]))

◆ 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:84

◆ R0

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

◆ R1

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

◆ R2

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

◆ R3

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

◆ R4

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

◆ le_to_be

#define le_to_be (   i)    ((rol((i),24) & 0xFF00FF00) | (rol((i),8) & 0x00FF00FF))

Function Documentation

◆ host_to_be()

static uint32_t host_to_be ( uint32_t  i)
static

◆ SHA1_Transform()

static void SHA1_Transform ( uint32_t  state[5],
const uint8_t  buffer[64] 
)
static

◆ crypto_SHA1_Init()

void crypto_SHA1_Init ( SHA1_CTX context)

◆ crypto_SHA1_Update()

void crypto_SHA1_Update ( SHA1_CTX context,
const uint8_t *  data,
const size_t  len 
)

◆ crypto_SHA1_Final()

void crypto_SHA1_Final ( SHA1_CTX context,
uint8_t *  digest 
)

◆ crypto_SHA1()

void crypto_SHA1 ( const uint8_t *  data,
size_t  len,
uint8_t *  digest 
)