Strophe: sha1.c File Reference

Strophe 0.10 XMPP client library

Macros | Functions | Variables
sha1.c File Reference

SHA-1 hash. More...

## Macros
#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)
#define | R1(v, w, x, y, z, i)
#define | R2(v, w, x, y, z, i)
#define | R3(v, w, x, y, z, i)
#define | R4(v, w, x, y, z, i)
#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])
static void | SHA1_cleanse (void *p, size_t len)
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)

## Variables
static void *(*volatile | SHA1_explicit_memset )(void *, int, size_t) = &memset

## Detailed Description

SHA-1 hash.

## Macro Definition Documentation

## ◆ 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))

## ◆ R0

#define R0 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);

## ◆ R1

#define R1 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);

## ◆ R2

#define R2 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); \
w = rol(w, 30);

## ◆ R3

#define R3 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
w = rol(w, 30);

## ◆ R4

#define R4 | ( |  | v,
|  |  | w,
|  |  | x,
|  |  | y,
|  |  | z,
|  |  | i
| ) |  |

Value:
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

## ◆ SHA1_cleanse()

static void SHA1_cleanse | ( | void * | p,
|  | size_t | len
| ) |  |
| 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
| ) |  |

## Variable Documentation

## ◆ SHA1_explicit_memset

void*(*volatile SHA1_explicit_memset) (void *, int, size_t) = &memset
| static

blk0
#define blk0(i)
Definition: sha1.c:85
blk
#define blk(i)
Definition: sha1.c:86
rol
#define rol(value, bits)
Definition: sha1.c:81