Botan
3.11.0
Crypto and TLS for C&
src
lib
hash
sha2_64
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
14
namespace
Botan
{
15
16
/*
17
* SHA-512 F1 Function
18
*/
19
BOTAN_FORCE_INLINE
void
SHA2_64_F
(uint64_t A,
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
H += magic +
rho<14, 18, 41>
(E) +
choose
(E, F, G) + M1;
33
D += H;
34
H +=
rho<28, 34, 39>
(A) +
majority
(A, B, C);
35
M1 +=
sigma<19, 61, 6>
(M2) + M3 +
sigma<1, 8, 7>
(M4);
36
}
37
38
/*
39
* SHA-512 F1 Function (No Message Expansion)
40
*/
41
BOTAN_FORCE_INLINE
void
SHA2_64_F
(
42
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 M) {
43
H +=
rho<14, 18, 41>
(E) +
choose
(E, F, G) + M;
44
D += H;
45
H +=
rho<28, 34, 39>
(A) +
majority
(A, B, C);
46
}
47
48
}
// namespace Botan
49
50
#endif
BOTAN_FORCE_INLINE
#define BOTAN_FORCE_INLINE
Definition
compiler.h:87
Botan
Definition
alg_id.cpp:13
Botan::majority
BOTAN_FORCE_INLINE constexpr T majority(T a, T b, T c)
Definition
bit_ops.h:222
Botan::SHA2_64_F
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
Botan::rho
BOTAN_FORCE_INLINE constexpr T rho(T x)
Definition
rotate.h:53
Botan::sigma
BOTAN_FORCE_INLINE constexpr T sigma(T x)
Definition
rotate.h:45
Botan::choose
BOTAN_FORCE_INLINE constexpr T choose(T mask, T a, T b)
Definition
bit_ops.h:216
Generated by
1.15.0