mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-18 00:23:38 +01:00
Add <Hasher>::OUTPUT_SIZE
This commit is contained in:
committed by
Pieter Wuille
parent
4791b99e2d
commit
a0495bb68c
16
src/hash.h
16
src/hash.h
@@ -19,10 +19,12 @@ class CHash256 {
|
||||
private:
|
||||
CSHA256 sha;
|
||||
public:
|
||||
void Finalize(unsigned char *hash) {
|
||||
unsigned char buf[32];
|
||||
static const size_t OUTPUT_SIZE = CSHA256::OUTPUT_SIZE;
|
||||
|
||||
void Finalize(unsigned char hash[OUTPUT_SIZE]) {
|
||||
unsigned char buf[sha.OUTPUT_SIZE];
|
||||
sha.Finalize(buf);
|
||||
sha.Reset().Write(buf, 32).Finalize(hash);
|
||||
sha.Reset().Write(buf, sha.OUTPUT_SIZE).Finalize(hash);
|
||||
}
|
||||
|
||||
CHash256& Write(const unsigned char *data, size_t len) {
|
||||
@@ -41,10 +43,12 @@ class CHash160 {
|
||||
private:
|
||||
CSHA256 sha;
|
||||
public:
|
||||
void Finalize(unsigned char *hash) {
|
||||
unsigned char buf[32];
|
||||
static const size_t OUTPUT_SIZE = CRIPEMD160::OUTPUT_SIZE;
|
||||
|
||||
void Finalize(unsigned char hash[OUTPUT_SIZE]) {
|
||||
unsigned char buf[sha.OUTPUT_SIZE];
|
||||
sha.Finalize(buf);
|
||||
CRIPEMD160().Write(buf, 32).Finalize(hash);
|
||||
CRIPEMD160().Write(buf, sha.OUTPUT_SIZE).Finalize(hash);
|
||||
}
|
||||
|
||||
CHash160& Write(const unsigned char *data, size_t len) {
|
||||
|
||||
Reference in New Issue
Block a user