Kagome
Polkadot Runtime Engine in C++17
blake2s.cpp File Reference
#include "blake2s.h"
#include <cstdint>
Include dependency graph for blake2s.cpp:

Go to the source code of this file.

Classes

struct  kagome::crypto::blake2s_ctx_full
 

Namespaces

 kagome::crypto
 

Macros

#define _256_bits   32
 
#define ROTR32(x, y)   (((x) >> (y)) ^ ((x) << (32 - (y))))
 
#define B2S_GET32(p)
 
#define B2S_G(a, b, c, d, x, y)
 

Functions

static void kagome::crypto::blake2s_compress (blake2s_ctx_full *ctx, int last)
 
void kagome::crypto::blake2s_update (blake2s_ctx *ctx, const void *in, size_t inlen)
 Update context with incoming bytes. More...
 
void kagome::crypto::blake2s_final (blake2s_ctx *ctx, void *out)
 Finalize hash calculation. More...
 
int kagome::crypto::blake2s_init (blake2s_ctx *ctx, size_t outlen, const void *key, size_t keylen)
 Generic blake2s init function. More...
 
int kagome::crypto::blake2s (void *out, size_t outlen, const void *key, size_t keylen, const void *in, size_t inlen)
 All in one blake2s hashing function. More...
 
void kagome::crypto::blake2s_256_init (blake2s_ctx *ctx)
 Initialize hash context. More...
 
void kagome::crypto::blake2s_256 (void *out, const void *in, size_t inlen)
 One-shot convenience function to calculate blake2s_256 hash. More...
 

Variables

static const uint32_t kagome::crypto::blake2s_iv [8]
 

Class Documentation

struct kagome::crypto::blake2s_ctx_full

Definition at line 29 of file blake2s.cpp.

Collaboration diagram for kagome::crypto::blake2s_ctx_full:
Class Members
uint8_t b[64]
size_t c
uint32_t h[8]
size_t outlen
uint32_t t[2]

Macro Definition Documentation

#define _256_bits   32

Definition at line 18 of file blake2s.cpp.

#define B2S_G (   a,
  b,
  c,
  d,
  x,
 
)
Value:
{ \
v[a] = v[a] + v[b] + (x); \
v[d] = ROTR32(v[d] ^ v[a], 16); \
v[c] = v[c] + v[d]; \
v[b] = ROTR32(v[b] ^ v[c], 12); \
v[a] = v[a] + v[b] + (y); \
v[d] = ROTR32(v[d] ^ v[a], 8); \
v[c] = v[c] + v[d]; \
v[b] = ROTR32(v[b] ^ v[c], 7); \
}
#define ROTR32(x, y)
Definition: blake2s.cpp:23

Definition at line 44 of file blake2s.cpp.

#define B2S_GET32 (   p)
Value:
(((uint32_t)((uint8_t *)(p))[0]) ^ (((uint32_t)((uint8_t *)(p))[1]) << 8) \
^ (((uint32_t)((uint8_t *)(p))[2]) << 16) \
^ (((uint32_t)((uint8_t *)(p))[3]) << 24))

Definition at line 37 of file blake2s.cpp.

#define ROTR32 (   x,
 
)    (((x) >> (y)) ^ ((x) << (32 - (y))))

Definition at line 23 of file blake2s.cpp.