Kagome
Polkadot Runtime Engine in C++17
blake2s.h
Go to the documentation of this file.
1 
6 // taken from here
7 // https://github.com/mjosaarinen/blake2_mjosref/blob/master/blake2s.h
8 
9 #ifndef CORE_BLAKE2S_HASH
10 #define CORE_BLAKE2S_HASH
11 
12 #include <cstdlib>
13 
14 namespace kagome::crypto {
15 
16  typedef struct {
17  unsigned char opaque[128];
18  } blake2s_ctx;
19 
24  void blake2s_256_init(blake2s_ctx *ctx);
25 
32  void blake2s_update(blake2s_ctx *ctx, const void *in, size_t inlen);
33 
40  void blake2s_final(blake2s_ctx *ctx, void *out);
41 
49  void blake2s_256(void *out, const void *in, size_t inlen);
50 
60  int blake2s_init(blake2s_ctx *ctx,
61  size_t outlen,
62  const void *key,
63  size_t keylen);
64 
76  int blake2s(void *out,
77  size_t outlen,
78  const void *key,
79  size_t keylen,
80  const void *in,
81  size_t inlen);
82 
83 } // namespace kagome::crypto
84 
85 #endif // CORE_BLAKE2S_HASH
void blake2s_256(void *out, const void *in, size_t inlen)
One-shot convenience function to calculate blake2s_256 hash.
Definition: blake2s.cpp:216
int blake2s(void *out, size_t outlen, const void *key, size_t keylen, const void *in, size_t inlen)
All in one blake2s hashing function.
Definition: blake2s.cpp:194
void blake2s_final(blake2s_ctx *ctx_opaque, void *out)
Finalize hash calculation.
Definition: blake2s.cpp:138
int blake2s_init(blake2s_ctx *ctx_opaque, size_t outlen, const void *key, size_t keylen)
Generic blake2s init function.
Definition: blake2s.cpp:159
void blake2s_256_init(blake2s_ctx *ctx_opaque)
Initialize hash context.
Definition: blake2s.cpp:212
void blake2s_update(blake2s_ctx *ctx_opaque, const void *in, size_t inlen)
Update context with incoming bytes.
Definition: blake2s.cpp:117