#include "system.h"
#include "rpmio_internal.h"
#include "debug.h"
Go to the source code of this file.
Data Structures | |
union | _mendian |
struct | DIGEST_CTX_s |
MD5/SHA1 digest private data. More... | |
Defines | |
#define | f1(x, y, z) ( z ^ ( x & ( y ^ z ) ) ) |
The SHA f()-functions. More... | |
#define | f2(x, y, z) ( x ^ y ^ z ) |
#define | f3(x, y, z) ( ( x & y ) | ( z & ( x | y ) ) ) |
#define | f4(x, y, z) ( x ^ y ^ z ) |
#define | K1 0x5A827999L |
The SHA Mysterious Constants. More... | |
#define | K2 0x6ED9EBA1L |
#define | K3 0x8F1BBCDCL |
#define | K4 0xCA62C1D6L |
#define | ROTL(n, X) ( ( (X) << (n) ) | ( (X) >> ( 32 - (n) ) ) ) |
32-bit rotate left - kludged with shifts. More... | |
#define | expand(W, i) |
The initial expanding function. More... | |
#define | subRound(a, b, c, d, e, f, k, data) |
The prototype SHA sub-round. More... | |
#define | DPRINTF(_a) |
#define | F1(x, y, z) (z ^ (x & (y ^ z))) |
The four core functions used in MD5 - F1 is optimized somewhat. More... | |
#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, data, s) |
The central step in the MD5 algorithm. More... | |
#define | IS_BIG_ENDIAN() (_endian->b[0] == '\x44') |
#define | IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11') |
Typedefs | |
typedef unsigned int | uint32 |
typedef unsigned char | byte |
Functions | |
void | SHA1Transform (DIGEST_CTX ctx) |
The core of the SHA algorithm. More... | |
void | MD5Transform (DIGEST_CTX ctx) |
The core of the MD5 algorithm. More... | |
void | byteReverse (byte *buf, unsigned nbytes) |
DIGEST_CTX | rpmDigestInit (rpmDigestFlags flags) |
void | rpmDigestUpdate (DIGEST_CTX ctx, const void *data, size_t len) |
void | rpmDigestFinal (DIGEST_CTX ctx, void **datap, size_t *lenp, int asAscii) |
Variables | |
int | _ie = 0x44332211 |
union _mendian * | _endian |
Definition in file digest.c.
|
Value: Referenced by SHA1Transform(), and rpmDigestInit().
|
|
The four core functions used in MD5 - F1 is optimized somewhat.
|
|
|
|
|
|
|
|
|
|
|
|
The SHA Mysterious Constants.
|
|
|
|
|
|
|
|
Value: ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
|
32-bit rotate left - kludged with shifts.
|
|
Value: ( W[ i & 15 ] = \ ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \ W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) ) The hash function is defined over an 80-word expanded input array W, where the first 16 are copies of the input data, and the remaining 64 are defined by
* W[ i ] = W[ i - 16 ] ^ W[ i - 14 ] ^ W[ i - 8 ] ^ W[ i - 3 ] * This implementation generates these values on the fly in a circular buffer - thanks to Colin Plumb, colin@nyx10.cs.du.edu for this optimization. The updated SHA changes the expanding function by adding a rotate of 1 bit. Thanks to Jim Gillogly, jim@rand.org, and an anonymous contributor for this information Definition at line 100 of file digest.c. Referenced by SHA1Transform().
|
|
The SHA f()-functions. The f1 and f3 functions can be optimized to save one boolean operation each - thanks to Rich Schroeppel, rcs@cs.arizona.edu for discovering this. |
|
|
|
|
|
|
|
Value: The prototype SHA sub-round.The fundamental sub-round is:
* a' = e + ROTL( 5, a ) + f( b, c, d ) + k + data; * b' = a; * c' = ROTL( 30, b ); * d' = c; * e' = d; * but this is implemented by unrolling the loop 5 times and renaming the variables ( e, a, b, c, d ) = ( a', b', c', d', e' ) each iteration. This code is then replicated 20 times for each of the 4 functions, using the next 20 values from the W[] array each time. Definition at line 122 of file digest.c. Referenced by SHA1Transform().
|
|
|
|
|
|
The core of the MD5 algorithm. Update MD5 context with next 64 bytes of plain text.
|
|
The core of the SHA algorithm. This alters an existing SHA hash to reflect the addition of 16 longwords of new data.
|
|
Definition at line 471 of file digest.c. Referenced by rpmDigestFinal(), rpmDigestUpdate(), rpmMD5Final(), and rpmMD5Update().
|
|
|
|
|