Botan 3.4.0
Crypto and TLS for C&
sha2_64_f.h
Go to the documentation of this file.
1/*
2* (C) 2023 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_SHA2_64_F_H_
8#define BOTAN_SHA2_64_F_H_
9
10#include <botan/types.h>
11#include <botan/internal/bit_ops.h>
12#include <botan/internal/rotate.h>
13
14namespace Botan {
15
16/*
17* SHA-512 F1 Function
18*/
20 uint64_t B,
21 uint64_t C,
22 uint64_t& D,
23 uint64_t E,
24 uint64_t F,
25 uint64_t G,
26 uint64_t& H,
27 uint64_t& M1,
28 uint64_t M2,
29 uint64_t M3,
30 uint64_t M4,
31 uint64_t magic) {
32 const uint64_t E_rho = rho<14, 18, 41>(E);
33 const uint64_t A_rho = rho<28, 34, 39>(A);
34 const uint64_t M2_sigma = sigma<19, 61, 6>(M2);
35 const uint64_t M4_sigma = sigma<1, 8, 7>(M4);
36 H += magic + E_rho + choose(E, F, G) + M1;
37 D += H;
38 H += A_rho + majority(A, B, C);
39 M1 += M2_sigma + M3 + M4_sigma;
40}
41
42} // namespace Botan
43
44#endif
#define BOTAN_FORCE_INLINE
Definition compiler.h:165
constexpr T choose(T mask, T a, T b)
Definition bit_ops.h:180
BOTAN_FORCE_INLINE void SHA2_64_F(uint64_t A, uint64_t B, uint64_t C, uint64_t &D, uint64_t E, uint64_t F, uint64_t G, uint64_t &H, uint64_t &M1, uint64_t M2, uint64_t M3, uint64_t M4, uint64_t magic)
Definition sha2_64_f.h:19
constexpr T majority(T a, T b, T c)
Definition bit_ops.h:186