Kagome
Polkadot Runtime Engine in C++17
hasher.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_HASHER_HASHER_HPP_
7 #define KAGOME_CORE_HASHER_HASHER_HPP_
8 
9 #include "common/blob.hpp"
10 #include "common/buffer.hpp"
11 
12 namespace kagome::crypto {
13  class Hasher {
14  protected:
19 
20  public:
21  virtual ~Hasher() = default;
22 
28  virtual Hash64 twox_64(gsl::span<const uint8_t> buffer) const = 0;
29 
35  virtual Hash64 blake2b_64(gsl::span<const uint8_t> buffer) const = 0;
36 
42  virtual Hash128 twox_128(gsl::span<const uint8_t> buffer) const = 0;
43 
49  virtual Hash128 blake2b_128(gsl::span<const uint8_t> buffer) const = 0;
50 
56  virtual Hash256 twox_256(gsl::span<const uint8_t> buffer) const = 0;
57 
63  virtual Hash256 blake2b_256(gsl::span<const uint8_t> buffer) const = 0;
64 
70  virtual Hash512 blake2b_512(gsl::span<const uint8_t> buffer) const = 0;
71 
77  virtual Hash256 keccak_256(gsl::span<const uint8_t> buffer) const = 0;
78 
84  virtual Hash256 blake2s_256(gsl::span<const uint8_t> buffer) const = 0;
85 
91  virtual Hash256 sha2_256(gsl::span<const uint8_t> buffer) const = 0;
92  };
93 } // namespace kagome::crypto
94 
95 #endif // KAGOME_CORE_HASHER_HASHER_HPP_
virtual Hash256 sha2_256(gsl::span< const uint8_t > buffer) const =0
sha2_256 function calculates 32-byte sha2-256 hash
Blob< 32 > Hash256
Definition: blob.hpp:230
virtual Hash512 blake2b_512(gsl::span< const uint8_t > buffer) const =0
blake2b_512 function calculates 64-byte blake2b hash
virtual Hash256 twox_256(gsl::span< const uint8_t > buffer) const =0
twox_256 calculates 32-byte twox hash
Blob< 16 > Hash128
Definition: blob.hpp:229
virtual Hash256 keccak_256(gsl::span< const uint8_t > buffer) const =0
keccak_256 function calculates 32-byte keccak hash
Blob< 64 > Hash512
Definition: blob.hpp:231
virtual Hash128 twox_128(gsl::span< const uint8_t > buffer) const =0
twox_128 calculates 16-byte twox hash
virtual Hash64 blake2b_64(gsl::span< const uint8_t > buffer) const =0
blake2b_64 function calculates 8-byte blake2b hash
virtual Hash256 blake2b_256(gsl::span< const uint8_t > buffer) const =0
blake2b_256 function calculates 32-byte blake2b hash
virtual Hash256 blake2s_256(gsl::span< const uint8_t > buffer) const =0
blake2s_256 function calculates 32-byte blake2s hash
virtual Hash128 blake2b_128(gsl::span< const uint8_t > buffer) const =0
blake2b_128 function calculates 16-byte blake2b hash
Blob< 8 > Hash64
Definition: blob.hpp:228
virtual ~Hasher()=default
virtual Hash64 twox_64(gsl::span< const uint8_t > buffer) const =0
twox_64 calculates 8-byte twox hash