2017-11-09 19:34:51 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
|
|
|
|
* Copyright (C) 2014 The Bitcoin Core developers
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2014-05-01 00:43:31 +02:00
|
|
|
|
2018-01-16 10:47:52 +00:00
|
|
|
#ifndef FLOWEE_CRYPTO_RIPEMD160_H
|
|
|
|
|
#define FLOWEE_CRYPTO_RIPEMD160_H
|
2014-05-01 00:43:31 +02:00
|
|
|
|
2017-08-17 20:53:23 -06:00
|
|
|
#include <cstdint>
|
2022-11-23 16:31:29 +01:00
|
|
|
#include <cassert>
|
2017-08-17 20:53:23 -06:00
|
|
|
#include <cstdlib>
|
2014-05-01 00:43:31 +02:00
|
|
|
|
|
|
|
|
/** A hasher class for RIPEMD-160. */
|
2014-09-25 08:23:32 +02:00
|
|
|
class CRIPEMD160
|
|
|
|
|
{
|
2014-05-01 00:43:31 +02:00
|
|
|
private:
|
|
|
|
|
uint32_t s[5];
|
|
|
|
|
unsigned char buf[64];
|
|
|
|
|
size_t bytes;
|
|
|
|
|
|
|
|
|
|
public:
|
2014-06-12 13:34:29 +02:00
|
|
|
static const size_t OUTPUT_SIZE = 20;
|
|
|
|
|
|
2014-05-01 00:43:31 +02:00
|
|
|
CRIPEMD160();
|
2022-05-17 00:46:54 +02:00
|
|
|
CRIPEMD160& write(const unsigned char* data, size_t len);
|
2022-11-23 16:31:29 +01:00
|
|
|
inline CRIPEMD160& write(const char* data, int len) {
|
|
|
|
|
assert(len >= 0);
|
|
|
|
|
return write(reinterpret_cast<const unsigned char*>(data), size_t(len));
|
|
|
|
|
}
|
2022-05-17 00:46:54 +02:00
|
|
|
void finalize(unsigned char hash[OUTPUT_SIZE]);
|
2022-11-23 16:31:29 +01:00
|
|
|
inline void finalize(char *hash) {
|
|
|
|
|
return finalize(reinterpret_cast<unsigned char*>(hash));
|
|
|
|
|
}
|
2022-05-17 00:46:54 +02:00
|
|
|
CRIPEMD160& reset();
|
2014-05-01 00:43:31 +02:00
|
|
|
};
|
|
|
|
|
|
2018-01-16 10:47:52 +00:00
|
|
|
#endif
|