Merge #12063: [Trivial] Update license year range to 2018
[bitcoinplatinum.git] / src / crypto / sha256.h
blobdd30fe396f17874f588fc78bd41ca2e7a647ea9c
1 // Copyright (c) 2014-2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_CRYPTO_SHA256_H
6 #define BITCOIN_CRYPTO_SHA256_H
8 #include <stdint.h>
9 #include <stdlib.h>
10 #include <string>
12 /** A hasher class for SHA-256. */
13 class CSHA256
15 private:
16 uint32_t s[8];
17 unsigned char buf[64];
18 uint64_t bytes;
20 public:
21 static const size_t OUTPUT_SIZE = 32;
23 CSHA256();
24 CSHA256& Write(const unsigned char* data, size_t len);
25 void Finalize(unsigned char hash[OUTPUT_SIZE]);
26 CSHA256& Reset();
29 /** Autodetect the best available SHA256 implementation.
30 * Returns the name of the implementation.
32 std::string SHA256AutoDetect();
34 #endif // BITCOIN_CRYPTO_SHA256_H