Mercurial > hg > toybox
changeset 171:d21f586b1b93
Minimal changes to make it actually work on an x86-64 host.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 24 Nov 2007 21:26:09 -0600 |
parents | 58a97722d745 |
children | 19d16003190b |
files | toys/sha1.c |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/sha1.c Sat Nov 24 21:25:18 2007 -0600 +++ b/toys/sha1.c Sat Nov 24 21:26:09 2007 -0600 @@ -12,19 +12,19 @@ 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F */ -/* #define LITTLE_ENDIAN * This should be #define'd if true. */ +#define LITTLE_ENDIAN /* This should be #define'd if true. */ /* #define SHA1HANDSOFF * Copies data before messing with it. */ #include <stdio.h> #include <string.h> typedef struct { - unsigned long state[5]; - unsigned long count[2]; + unsigned int state[5]; + unsigned int count[2]; unsigned char buffer[64]; } SHA1_CTX; -void SHA1Transform(unsigned long state[5], unsigned char buffer[64]); +void SHA1Transform(unsigned int state[5], unsigned char buffer[64]); void SHA1Init(SHA1_CTX* context); void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len); void SHA1Final(unsigned char digest[20], SHA1_CTX* context); @@ -52,12 +52,12 @@ /* Hash a single 512-bit block. This is the core of the algorithm. */ -void SHA1Transform(unsigned long state[5], unsigned char buffer[64]) +void SHA1Transform(unsigned int state[5], unsigned char buffer[64]) { -unsigned long a, b, c, d, e; +unsigned int a, b, c, d, e; typedef union { unsigned char c[64]; - unsigned long l[16]; + unsigned int l[16]; } CHAR64LONG16; CHAR64LONG16* block; #ifdef SHA1HANDSOFF @@ -145,7 +145,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context) { -unsigned long i, j; +unsigned int i, j; unsigned char finalcount[8]; for (i = 0; i < 8; i++) {