5 return (w >> c) | (w << (32 - c));
10 state[a] = state[a] + state[b] + x;
11 state[d] =
rotr32(state[d] ^ state[a], 16);
12 state[c] = state[c] + state[d];
13 state[b] =
rotr32(state[b] ^ state[c], 12);
14 state[a] = state[a] + state[b] + y;
15 state[d] =
rotr32(state[d] ^ state[a], 8);
16 state[c] = state[c] + state[d];
17 state[b] =
rotr32(state[b] ^ state[c], 7);
25 g(state, 0, 4, 8, 12, msg[schedule[0]], msg[schedule[1]]);
26 g(state, 1, 5, 9, 13, msg[schedule[2]], msg[schedule[3]]);
27 g(state, 2, 6, 10, 14, msg[schedule[4]], msg[schedule[5]]);
28 g(state, 3, 7, 11, 15, msg[schedule[6]], msg[schedule[7]]);
31 g(state, 0, 5, 10, 15, msg[schedule[8]], msg[schedule[9]]);
32 g(state, 1, 6, 11, 12, msg[schedule[10]], msg[schedule[11]]);
33 g(state, 2, 7, 8, 13, msg[schedule[12]], msg[schedule[13]]);
34 g(state, 3, 4, 9, 14, msg[schedule[14]], msg[schedule[15]]);
39 uint8_t block_len,
uint64_t counter, uint8_t flags) {
90 cv[0] = state[0] ^ state[8];
91 cv[1] = state[1] ^ state[9];
92 cv[2] = state[2] ^ state[10];
93 cv[3] = state[3] ^ state[11];
94 cv[4] = state[4] ^ state[12];
95 cv[5] = state[5] ^ state[13];
96 cv[6] = state[6] ^ state[14];
97 cv[7] = state[7] ^ state[15];
102 uint8_t block_len,
uint64_t counter,
103 uint8_t flags, uint8_t out[64]) {
107 store32(&out[0 * 4], state[0] ^ state[8]);
108 store32(&out[1 * 4], state[1] ^ state[9]);
109 store32(&out[2 * 4], state[2] ^ state[10]);
110 store32(&out[3 * 4], state[3] ^ state[11]);
111 store32(&out[4 * 4], state[4] ^ state[12]);
112 store32(&out[5 * 4], state[5] ^ state[13]);
113 store32(&out[6 * 4], state[6] ^ state[14]);
114 store32(&out[7 * 4], state[7] ^ state[15]);
115 store32(&out[8 * 4], state[8] ^ cv[0]);
116 store32(&out[9 * 4], state[9] ^ cv[1]);
117 store32(&out[10 * 4], state[10] ^ cv[2]);
118 store32(&out[11 * 4], state[11] ^ cv[3]);
119 store32(&out[12 * 4], state[12] ^ cv[4]);
120 store32(&out[13 * 4], state[13] ^ cv[5]);
121 store32(&out[14 * 4], state[14] ^ cv[6]);
122 store32(&out[15 * 4], state[15] ^ cv[7]);
127 uint8_t flags, uint8_t flags_start,
131 uint8_t block_flags = flags | flags_start;
134 block_flags |= flags_end;
147 uint64_t counter,
bool increment_counter,
148 uint8_t flags, uint8_t flags_start,
149 uint8_t flags_end, uint8_t *out) {
150 while (num_inputs > 0) {
153 if (increment_counter) {
bbsections Prepares for basic block by splitting functions into clusters of basic blocks
unify loop Fixup each natural loop to have a single exit block
static const uint8_t MSG_SCHEDULE[7][16]
static const uint32_t IV[8]
INLINE uint32_t counter_high(uint64_t counter)
INLINE void store_cv_words(uint8_t bytes_out[32], uint32_t cv_words[8])
INLINE uint32_t load32(const void *src)
INLINE void store32(void *dst, uint32_t w)
INLINE uint32_t counter_low(uint64_t counter)
INLINE uint32_t rotr32(uint32_t w, uint32_t c)
INLINE void round_fn(uint32_t state[16], const uint32_t *msg, size_t round)
INLINE void g(uint32_t *state, size_t a, size_t b, size_t c, size_t d, uint32_t x, uint32_t y)
INLINE void hash_one_portable(const uint8_t *input, size_t blocks, const uint32_t key[8], uint64_t counter, uint8_t flags, uint8_t flags_start, uint8_t flags_end, uint8_t out[BLAKE3_OUT_LEN])
INLINE void compress_pre(uint32_t state[16], const uint32_t cv[8], const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len, uint64_t counter, uint8_t flags)
#define blake3_compress_xof_portable
#define blake3_hash_many_portable
#define blake3_compress_in_place_portable
static uint64_t round(uint64_t Acc, uint64_t Input)