Browse Source

crypto: bytes counts are 64 bit

Byte counts for SHA256, SHA512, SHA1 and RIPEMD160 must be 64 bits.
`size_t` has a different size per platform, causing divergent results
when hashing more than 4GB of data.
0.13
Wladimir J. van der Laan 8 years ago
parent
commit
9ad1a51857
  1. 2
      src/crypto/ripemd160.h
  2. 2
      src/crypto/sha1.h
  3. 2
      src/crypto/sha256.h
  4. 2
      src/crypto/sha512.h

2
src/crypto/ripemd160.h

@ -14,7 +14,7 @@ class CRIPEMD160 @@ -14,7 +14,7 @@ class CRIPEMD160
private:
uint32_t s[5];
unsigned char buf[64];
size_t bytes;
uint64_t bytes;
public:
static const size_t OUTPUT_SIZE = 20;

2
src/crypto/sha1.h

@ -14,7 +14,7 @@ class CSHA1 @@ -14,7 +14,7 @@ class CSHA1
private:
uint32_t s[5];
unsigned char buf[64];
size_t bytes;
uint64_t bytes;
public:
static const size_t OUTPUT_SIZE = 20;

2
src/crypto/sha256.h

@ -14,7 +14,7 @@ class CSHA256 @@ -14,7 +14,7 @@ class CSHA256
private:
uint32_t s[8];
unsigned char buf[64];
size_t bytes;
uint64_t bytes;
public:
static const size_t OUTPUT_SIZE = 32;

2
src/crypto/sha512.h

@ -14,7 +14,7 @@ class CSHA512 @@ -14,7 +14,7 @@ class CSHA512
private:
uint64_t s[8];
unsigned char buf[128];
size_t bytes;
uint64_t bytes;
public:
static const size_t OUTPUT_SIZE = 64;

Loading…
Cancel
Save