barretenberg
Loading...
Searching...
No Matches
hashers.hpp
1#pragma once
2
3#include "../blake2s/blake2s.hpp"
4#include "../keccak/keccak.hpp"
5#include "../sha256/sha256.hpp"
6
7#include "memory.h"
8#include <vector>
10 static constexpr size_t BLOCK_SIZE = 64;
11 static constexpr size_t OUTPUT_SIZE = 32;
12 static std::vector<uint8_t> hash(const std::vector<uint8_t>& message)
13 {
14 keccak256 hash_result = ethash_keccak256(&message[0], message.size());
15
16 std::vector<uint8_t> output;
17 output.resize(32);
18
19 memcpy((void*)&output[0], (void*)&hash_result.word64s[0], 32);
20 return output;
21 }
22};
23
25 static constexpr size_t BLOCK_SIZE = 64;
26 static constexpr size_t OUTPUT_SIZE = 32;
27
28 template <typename B = std::vector<uint8_t>> static auto hash(const B& message) { return sha256::sha256(message); }
29};
30
32 static constexpr size_t BLOCK_SIZE = 64;
33 static constexpr size_t OUTPUT_SIZE = 32;
34 static auto hash(const std::vector<uint8_t>& message) { return blake2::blake2s(message); }
35};
Definition: hashers.hpp:31
Definition: hashers.hpp:9
Definition: hashers.hpp:24
Definition: hash_types.hpp:14