diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-06-15 13:09:11 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-06-15 13:09:11 +0200 |
commit | 83d23939db58a3d59d97e26c7dc3cfd9ea7927d9 (patch) | |
tree | bedf503ae7271df6976078574ebf8a121bb69125 /src/sha1 | |
parent | 0e421ccebd3ebabfbbabcae96acc262b76198ad2 (diff) |
melonDSi: skeleton in place
Diffstat (limited to 'src/sha1')
-rw-r--r-- | src/sha1/sha1.c | 17 | ||||
-rw-r--r-- | src/sha1/sha1.h | 10 |
2 files changed, 15 insertions, 12 deletions
diff --git a/src/sha1/sha1.c b/src/sha1/sha1.c index 2c50433..3729550 100644 --- a/src/sha1/sha1.c +++ b/src/sha1/sha1.c @@ -42,7 +42,8 @@ A million repetitions of "a" #if defined(vax) || defined(ns32000) || defined(sun386) || defined(__i386__) || \ defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ - defined(__alpha__) || defined(__alpha) + defined(__alpha__) || defined(__alpha) || \ + defined(__WIN32__) #define BYTE_ORDER LITTLE_ENDIAN #endif @@ -103,12 +104,12 @@ A million repetitions of "a" /* Hash a single 512-bit block. This is the core of the algorithm. */ -void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]) +void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]) { -u_int32_t a, b, c, d, e; +uint32_t a, b, c, d, e; typedef union { unsigned char c[64]; - u_int32_t l[16]; + uint32_t l[16]; } CHAR64LONG16; #ifdef SHA1HANDSOFF CHAR64LONG16 block[1]; /* use array to appear as a pointer */ @@ -178,10 +179,10 @@ void SHA1Init(SHA1_CTX* context) /* Run your data through this. */ -void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len) +void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len) { -u_int32_t i; -u_int32_t j; +uint32_t i; +uint32_t j; j = context->count[0]; if ((context->count[0] += len << 3) < j) @@ -219,7 +220,7 @@ unsigned char c; for (i = 0; i < 2; i++) { - u_int32_t t = context->count[i]; + uint32_t t = context->count[i]; int j; for (j = 0; j < 4; t >>= 8, j++) diff --git a/src/sha1/sha1.h b/src/sha1/sha1.h index 9d6f129..56ffa56 100644 --- a/src/sha1/sha1.h +++ b/src/sha1/sha1.h @@ -5,13 +5,15 @@ By Steve Reid <steve@edmweb.com> 100% Public Domain */ +#include <stdint.h> + typedef struct { - u_int32_t state[5]; - u_int32_t count[2]; + uint32_t state[5]; + uint32_t count[2]; unsigned char buffer[64]; } SHA1_CTX; -void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]); +void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]); void SHA1Init(SHA1_CTX* context); -void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len); +void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len); void SHA1Final(unsigned char digest[20], SHA1_CTX* context); |