Raven Core  3.0.0
P2P Digital Currency
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
sha256.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_CRYPTO_SHA256_H
7 #define RAVEN_CRYPTO_SHA256_H
8 
9 #include <stdint.h>
10 #include <stdlib.h>
11 #include <string>
12 
14 class CSHA256
15 {
16 private:
17  uint32_t s[8];
18  unsigned char buf[64];
19  uint64_t bytes;
20 
21 public:
22  static const size_t OUTPUT_SIZE = 32;
23 
24  CSHA256();
25  CSHA256& Write(const unsigned char* data, size_t len);
26  void Finalize(unsigned char hash[OUTPUT_SIZE]);
27  CSHA256& Reset();
28 };
29 
33 std::string SHA256AutoDetect();
34 
35 #endif // RAVEN_CRYPTO_SHA256_H
CSHA256 & Write(const unsigned char *data, size_t len)
Definition: sha256.cpp:202
uint32_t s[8]
Definition: sha256.h:17
CSHA256 & Reset()
Definition: sha256.cpp:245
void Finalize(unsigned char hash[OUTPUT_SIZE])
Definition: sha256.cpp:228
uint64_t bytes
Definition: sha256.h:19
static const size_t OUTPUT_SIZE
Definition: sha256.h:22
CSHA256()
Definition: sha256.cpp:197
unsigned char buf[64]
Definition: sha256.h:18
std::string SHA256AutoDetect()
Autodetect the best available SHA256 implementation.
Definition: sha256.cpp:180
A hasher class for SHA-256.
Definition: sha256.h:14