Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
blake2.hpp
Go to the documentation of this file.
1// Snark - Wrapper for alt_bn128 add mul pair and modexp
2
3#pragma once
4
5#include <functional>
6#include <cstdint>
7#include <variant>
8#include <vector>
9#include <fc/utility.hpp>
10
11namespace fc {
12 using bytes = std::vector<char>;
13
14 enum class blake2b_error : int32_t {
16 };
17
18 std::variant<blake2b_error, bytes> blake2b(uint32_t _rounds, const bytes& _h, const bytes& _m, const bytes& _t0_offset, const bytes& _t1_offset, bool _f, const yield_function_t& yield);
19
20 typedef struct {
21 uint64_t h[8] = {0,0,0,0,0,0,0,0};
22 uint64_t t[2] = {0,0};
23 uint64_t f[1] = {0};
24 } blake2b_state;
25
27 public:
29 void blake2b_compress(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES], size_t r, const yield_function_t& yield );
30
31 private:
32 uint64_t m[16];
33 uint64_t v[16];
34 size_t i;
35
36 inline void G(uint8_t r, uint8_t i, uint64_t& a, uint64_t& b, uint64_t& c, uint64_t& d) noexcept;
37 inline void ROUND(uint8_t r) noexcept;
38
39 void blake2b_compress_init(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES], size_t r);
40 void blake2b_compress_end(blake2b_state *S);
41 };
42}
const mie::Vuint & r
Definition bn.cpp:28
void blake2b_compress(blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES], size_t r, const yield_function_t &yield)
Definition blake2.cpp:67
namespace sysio::chain
Definition authority.cpp:3
std::vector< char > bytes
Definition alt_bn128.hpp:10
std::variant< blake2b_error, bytes > blake2b(uint32_t _rounds, const bytes &_h, const bytes &_m, const bytes &_t0_offset, const bytes &_t1_offset, bool _f, const yield_function_t &yield)
Definition blake2.cpp:105
optional_delegate< void()> yield_function_t
Definition utility.hpp:205
blake2b_error
Definition blake2.hpp:14
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
unsigned int uint32_t
Definition stdint.h:126
signed int int32_t
Definition stdint.h:123
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136