Botan
3.6.1
Crypto and TLS for C&
src
lib
hash
sha2_32
sha2_32_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_32_F_H_
8
#define BOTAN_SHA2_32_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-256 F1 Function
18
*/
19
BOTAN_FORCE_INLINE
void
SHA2_32_F
(uint32_t A,
20
uint32_t B,
21
uint32_t C,
22
uint32_t& D,
23
uint32_t E,
24
uint32_t F,
25
uint32_t G,
26
uint32_t& H,
27
uint32_t& M1,
28
uint32_t M2,
29
uint32_t M3,
30
uint32_t M4,
31
uint32_t magic) {
32
uint32_t A_rho =
rho<2, 13, 22>
(A);
33
uint32_t E_rho =
rho<6, 11, 25>
(E);
34
uint32_t M2_sigma =
sigma<17, 19, 10>
(M2);
35
uint32_t M4_sigma =
sigma<7, 18, 3>
(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
BOTAN_FORCE_INLINE
#define BOTAN_FORCE_INLINE
Definition
compiler.h:165
Botan
Definition
alg_id.cpp:13
Botan::rho
constexpr T rho(T x)
Definition
rotate.h:51
Botan::sigma
constexpr T sigma(T x)
Definition
rotate.h:43
Botan::choose
constexpr T choose(T mask, T a, T b)
Definition
bit_ops.h:193
Botan::majority
constexpr T majority(T a, T b, T c)
Definition
bit_ops.h:199
Botan::SHA2_32_F
BOTAN_FORCE_INLINE void SHA2_32_F(uint32_t A, uint32_t B, uint32_t C, uint32_t &D, uint32_t E, uint32_t F, uint32_t G, uint32_t &H, uint32_t &M1, uint32_t M2, uint32_t M3, uint32_t M4, uint32_t magic)
Definition
sha2_32_f.h:19
Generated by
1.12.0