mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #9791: Avoid VLA in hash.h
5c8fd50
Avoid VLA in hash.h (Pieter Wuille)
This commit is contained in:
parent
39f08b6e66
commit
16b2a1d1b9
@ -78,9 +78,9 @@ public:
|
|||||||
static const size_t OUTPUT_SIZE = CSHA256::OUTPUT_SIZE;
|
static const size_t OUTPUT_SIZE = CSHA256::OUTPUT_SIZE;
|
||||||
|
|
||||||
void Finalize(unsigned char hash[OUTPUT_SIZE]) {
|
void Finalize(unsigned char hash[OUTPUT_SIZE]) {
|
||||||
unsigned char buf[sha.OUTPUT_SIZE];
|
unsigned char buf[CSHA256::OUTPUT_SIZE];
|
||||||
sha.Finalize(buf);
|
sha.Finalize(buf);
|
||||||
sha.Reset().Write(buf, sha.OUTPUT_SIZE).Finalize(hash);
|
sha.Reset().Write(buf, CSHA256::OUTPUT_SIZE).Finalize(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHash256& Write(const unsigned char *data, size_t len) {
|
CHash256& Write(const unsigned char *data, size_t len) {
|
||||||
@ -102,9 +102,9 @@ public:
|
|||||||
static const size_t OUTPUT_SIZE = CRIPEMD160::OUTPUT_SIZE;
|
static const size_t OUTPUT_SIZE = CRIPEMD160::OUTPUT_SIZE;
|
||||||
|
|
||||||
void Finalize(unsigned char hash[OUTPUT_SIZE]) {
|
void Finalize(unsigned char hash[OUTPUT_SIZE]) {
|
||||||
unsigned char buf[sha.OUTPUT_SIZE];
|
unsigned char buf[CSHA256::OUTPUT_SIZE];
|
||||||
sha.Finalize(buf);
|
sha.Finalize(buf);
|
||||||
CRIPEMD160().Write(buf, sha.OUTPUT_SIZE).Finalize(hash);
|
CRIPEMD160().Write(buf, CSHA256::OUTPUT_SIZE).Finalize(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHash160& Write(const unsigned char *data, size_t len) {
|
CHash160& Write(const unsigned char *data, size_t len) {
|
||||||
|
Loading…
Reference in New Issue
Block a user