From 9fe99014ffc382052994189437023ded246629c1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 24 Nov 2007 21:26:09 -0600 Subject: Minimal changes to make it actually work on an x86-64 host. --- toys/sha1.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'toys/sha1.c') diff --git a/toys/sha1.c b/toys/sha1.c index 35357aab..d4a96840 100644 --- a/toys/sha1.c +++ b/toys/sha1.c @@ -12,19 +12,19 @@ A million repetitions of "a" 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 #include 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 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context); /* 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 @@ unsigned int i, j; 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++) { -- cgit v1.2.3