#include <string.h>
#include <sys/types.h>
#include "md5.h"
Go to the source code of this file.
|
#define | F1(x, y, z) (z ^ (x & (y ^ z))) |
|
#define | F2(x, y, z) F1(z, x, y) |
|
#define | F3(x, y, z) (x ^ y ^ z) |
|
#define | F4(x, y, z) (y ^ (x | ~z)) |
|
#define | MD5STEP(f, w, x, y, z, in, s) (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) |
|
#define | HEX_STRING "0123456789abcdef" /* to convert to hex */ |
|
#define F1 |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (z ^ (x & (y ^ z))) |
#define F2 |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| F1(z, x, y) |
#define F3 |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (x ^ y ^ z) |
#define F4 |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (y ^ (x | ~z)) |
#define HEX_STRING "0123456789abcdef" /* to convert to hex */ |
#define MD5STEP |
( |
|
f, |
|
|
|
w, |
|
|
|
x, |
|
|
|
y, |
|
|
|
z, |
|
|
|
in, |
|
|
|
s |
|
) |
| (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) |
static void byteSwap |
( |
UWORD32 * |
buf, |
|
|
unsigned |
words |
|
) |
| |
|
static |
Definition at line 61 of file md5.c.
70 *buf++ = (
UWORD32)((
unsigned)p[3] << 8 | p[2]) << 16 |
71 ((
unsigned)p[1] << 8 | p[0]);
static void detectEndianess |
( |
| ) |
|
|
static |
Definition at line 35 of file md5.c.
40 unsigned char *
p = (
unsigned char *)(&nl);
41 unsigned char *sp = (
unsigned char *)(&ns);
44 if ( p[0] == 0x12 && p[1] == 0x34 && p[2] == 0x56 && p[3] == 0x78 )
48 else if ( p[0] == 0x78 && p[1] == 0x56 && p[2] == 0x34 && p[3] == 0x12 )
std::string nl(std::size_t i=1)
void MD5Buffer |
( |
const unsigned char * |
buf, |
|
|
unsigned int |
len, |
|
|
unsigned char |
sig[16] |
|
) |
| |
Definition at line 275 of file md5.c.
void MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
void MD5Init(struct MD5Context *ctx)
void MD5Final(md5byte digest[16], struct MD5Context *ctx)
Definition at line 139 of file md5.c.
148 count = 56 - 1 - count;
151 memset(p, 0, count + 8);
161 ctx->
in[14] = ctx->
bytes[0] << 3;
166 memcpy(digest, ctx->
buf, 16);
167 memset(ctx, 0,
sizeof(*ctx));
void MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
static void byteSwap(UWORD32 *buf, unsigned words)
Definition at line 81 of file md5.c.
85 ctx->
buf[0] = 0x67452301;
86 ctx->
buf[1] = 0xefcdab89;
87 ctx->
buf[2] = 0x98badcfe;
88 ctx->
buf[3] = 0x10325476;
static void detectEndianess()
void MD5SigToString |
( |
unsigned char |
signature[16], |
|
|
char * |
str, |
|
|
int |
len |
|
) |
| |
Definition at line 285 of file md5.c.
287 unsigned char *sig_p;
289 unsigned int high, low;
294 for (sig_p = (
unsigned char *)signature;
295 sig_p < (
unsigned char *)signature + 16;
301 if (str_p + 1 >= max_p) {
Definition at line 190 of file md5.c.
#define MD5STEP(f, w, x, y, z, in, s)
Definition at line 99 of file md5.c.
106 if ((ctx->
bytes[0] = t + len) < t)
123 memcpy(ctx->
in,
buf, 64);
131 memcpy(ctx->
in,
buf, len);
void MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
static void byteSwap(UWORD32 *buf, unsigned words)
Definition at line 31 of file md5.c.
int g_endianessDetected = 0 |
Definition at line 32 of file md5.c.