#include <stdio.h>
#include <stdint.h>
#include "md5.h"
Go to the source code of this file.
Defines |
#define | GET_U32_LE(n, b, i) |
#define | PUT_U32_LE(n, b, i) |
#define | S(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) |
#define | P(a, b, c, d, k, s, t) |
#define | F(x, y, z) (z ^ (x & (y ^ z))) |
#define | F(x, y, z) (y ^ (z & (x ^ y))) |
#define | F(x, y, z) (x ^ y ^ z) |
#define | F(x, y, z) (y ^ (x | ~z)) |
Functions |
void | md5 (const unsigned char *input, size_t ilen, unsigned char output[16]) |
| Output = MD5( input buffer )
|
int | md5_file (const char *path, unsigned char output[16]) |
| Output = MD5( file contents )
|
Define Documentation
#define F |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (z ^ (x & (y ^ z))) |
#define F |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (y ^ (z & (x ^ y))) |
#define F |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (x ^ y ^ z) |
#define F |
( |
|
x, |
|
|
|
y, |
|
|
|
z |
|
) |
| (y ^ (x | ~z)) |
Value:{ \
(n) = ( (uint32_t) (b)[(i) ] ) \
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
| ( (uint32_t) (b)[(i) + 2] << 16 ) \
| ( (uint32_t) (b)[(i) + 3] << 24 ); \
}
Definition at line 53 of file md5.c.
#define P |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d, |
|
|
|
k, |
|
|
|
s, |
|
|
|
t |
|
) |
| |
Value:{ \
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
}
Value:{ \
(b)[(i) ] = (unsigned char) ( (n) ); \
(b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \
(b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \
(b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \
}
Definition at line 63 of file md5.c.
#define S |
( |
|
x, |
|
|
|
n |
|
) |
| ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) |
Function Documentation
void md5 |
( |
const unsigned char * |
input, |
|
|
size_t |
ilen, |
|
|
unsigned char |
output[16] |
|
) |
| |
Output = MD5( input buffer )
- Parameters:
-
input | buffer holding the data |
ilen | length of the input data |
output | MD5 checksum result |
Definition at line 292 of file md5.c.
int md5_file |
( |
const char * |
path, |
|
|
unsigned char |
output[16] |
|
) |
| |
Output = MD5( file contents )
- Parameters:
-
path | input file name |
output | MD5 checksum result |
- Returns:
- 0 if successful, 1 if fopen failed, or 2 if fread failed
Definition at line 306 of file md5.c.
Referenced by alpm_compute_md5sum().