libalpm
Arch Linux Package Manager Library
Defines | Functions
md5.c File Reference
#include <stdio.h>
#include <stdint.h>
#include "md5.h"
Include dependency graph for md5.c:

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 ^ (x & (y ^ z)))
#define F (   x,
  y,
 
)    (y ^ (z & (x ^ y)))
#define F (   x,
  y,
 
)    (x ^ y ^ z)
#define F (   x,
  y,
 
)    (y ^ (x | ~z))
#define GET_U32_LE (   n,
  b,
 
)
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,
 
)
Value:
{                                                       \
    a += F(b,c,d) + X[k] + t; a = S(a,s) + b;           \
}
#define PUT_U32_LE (   n,
  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,
 
)    ((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:
inputbuffer holding the data
ilenlength of the input data
outputMD5 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:
pathinput file name
outputMD5 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().

Here is the caller graph for this function: