jabber/sha.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Go to the source code of this file.
|
Defines |
| #define | Ai 0x67452301 |
| #define | Bi 0xefcdab89 |
| #define | Ci 0x98badcfe |
| #define | Di 0x10325476 |
| #define | Ei 0xc3d2e1f0 |
| #define | f1(B, C, D) ((B & C) | ((~B) & D)) |
| #define | f2(B, C, D) (B ^ C ^ D) |
| #define | f3(B, C, D) ((B & C) | (B & D) | (C & D)) |
| #define | INT64 long long |
| #define | K1 0x5a827999 |
| #define | K2 0x6ed9eba1 |
| #define | K3 0x8f1bbcdc |
| #define | K4 0xca62c1d6 |
| #define | rol1(x) ((x<<1) | ((x>>31) & 1)) |
| #define | rol30(B) ((B<<30) | ((B>>2) & 0x3fffffff)) |
| #define | rol5(A) ((A<<5) | ((A>>27) & 0x1f)) |
| #define | switch_endianness(x) |
Functions |
| int | sha_hash (int *data, int *hash) |
| int | sha_init (int *hash) |
| char * | shahash (const char *str) |
| int | strprintsha (char *dest, int *hashval) |
Define Documentation
| #define f1 |
( |
B, |
|
|
C, |
|
|
D |
|
) |
((B & C) | ((~B) & D)) |
| #define f2 |
( |
B, |
|
|
C, |
|
|
D |
|
) |
(B ^ C ^ D) |
| #define f3 |
( |
B, |
|
|
C, |
|
|
D |
|
) |
((B & C) | (B & D) | (C & D)) |
| #define rol1 |
( |
x |
|
) |
((x<<1) | ((x>>31) & 1)) |
| #define rol30 |
( |
B |
|
) |
((B<<30) | ((B>>2) & 0x3fffffff)) |
| #define rol5 |
( |
A |
|
) |
((A<<5) | ((A>>27) & 0x1f)) |
| #define switch_endianness |
( |
x |
|
) |
|
Value:
(x<<24 & 0xff000000) | \
(x<<8 & 0x00ff0000) | \
(x>>8 & 0x0000ff00) | \
(x>>24 & 0x000000ff)
Definition at line 64 of file jabber/sha.c.
Referenced by sha_hash().
Function Documentation
| int sha_hash |
( |
int * |
data, |
|
|
int * |
hash | |
|
) |
| | |
Definition at line 98 of file jabber/sha.c.
References f1, f2, f3, K1, K2, K3, K4, rol1, rol30, rol5, and switch_endianness.
Referenced by shahash().
| int sha_init |
( |
int * |
hash |
) |
|
| char* shahash |
( |
const char * |
str |
) |
|
| int strprintsha |
( |
char * |
dest, |
|
|
int * |
hashval | |
|
) |
| | |