mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
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.
This commit is contained in:
parent
73fc922ed6
commit
9ad1a51857
@ -14,7 +14,7 @@ class CRIPEMD160
|
|||||||
private:
|
private:
|
||||||
uint32_t s[5];
|
uint32_t s[5];
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
size_t bytes;
|
uint64_t bytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 20;
|
static const size_t OUTPUT_SIZE = 20;
|
||||||
|
@ -14,7 +14,7 @@ class CSHA1
|
|||||||
private:
|
private:
|
||||||
uint32_t s[5];
|
uint32_t s[5];
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
size_t bytes;
|
uint64_t bytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 20;
|
static const size_t OUTPUT_SIZE = 20;
|
||||||
|
@ -14,7 +14,7 @@ class CSHA256
|
|||||||
private:
|
private:
|
||||||
uint32_t s[8];
|
uint32_t s[8];
|
||||||
unsigned char buf[64];
|
unsigned char buf[64];
|
||||||
size_t bytes;
|
uint64_t bytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 32;
|
static const size_t OUTPUT_SIZE = 32;
|
||||||
|
@ -14,7 +14,7 @@ class CSHA512
|
|||||||
private:
|
private:
|
||||||
uint64_t s[8];
|
uint64_t s[8];
|
||||||
unsigned char buf[128];
|
unsigned char buf[128];
|
||||||
size_t bytes;
|
uint64_t bytes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const size_t OUTPUT_SIZE = 64;
|
static const size_t OUTPUT_SIZE = 64;
|
||||||
|
Loading…
Reference in New Issue
Block a user