digestpp 1.0
C++11 header-only message digest library
Loading...
Searching...
No Matches
blake2_constants.hpp
Go to the documentation of this file.
1/*
2This code is written by kerukuro and released into public domain.
3*/
4
5#ifndef DIGESTPP_PROVIDERS_BLAKE2_CONSTANTS_HPP
6#define DIGESTPP_PROVIDERS_BLAKE2_CONSTANTS_HPP
7
8namespace digestpp
9{
10
11namespace detail
12{
13
14template<typename T>
16{
17 const static uint64_t IV[8];
18};
19
20template<typename T>
21const uint64_t blake2b_constants<T>::IV[8] = {
22 0x6A09E667F3BCC908ull, 0xBB67AE8584CAA73Bull, 0x3C6EF372FE94F82Bull, 0xA54FF53A5F1D36F1ull,
23 0x510E527FADE682D1ull, 0x9B05688C2B3E6C1Full, 0x1F83D9ABFB41BD6Bull, 0x5BE0CD19137E2179ull
24};
25
26template<typename T>
28{
29 const static uint32_t IV[8];
30};
31
32template<typename T>
33const uint32_t blake2s_constants<T>::IV[8] = {
34 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
35};
36
37template<typename T>
39{
40 static const uint32_t S[12][16];
41
42};
43
44template<typename T>
45const uint32_t blake2_constants<T>::S[12][16] = {
46 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
47 { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
48 { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
49 { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
50 { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
51 { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
52 { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
53 { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
54 { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
55 { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
56 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
57 { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
58};
59
60enum class blake2_type
61{
62 hash,
63 x_hash,
64 xof
65};
66
67} // namespace detail
68
69} // namespace digestpp
70
71#endif
blake2_type
Definition blake2_constants.hpp:61
digestpp namespace
Definition ascon.hpp:14
Definition blake2_constants.hpp:39
static const uint32_t S[12][16]
Definition blake2_constants.hpp:40
Definition blake2_constants.hpp:16
static const uint64_t IV[8]
Definition blake2_constants.hpp:17
Definition blake2_constants.hpp:28
static const uint32_t IV[8]
Definition blake2_constants.hpp:29