Coverage Report

Created: 2025-12-05 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Botan-3.4.0/src/lib/hash/rmd160/rmd160.cpp
Line
Count
Source
1
/*
2
* RIPEMD-160
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#include <botan/internal/rmd160.h>
9
10
#include <botan/internal/bit_ops.h>
11
#include <botan/internal/loadstor.h>
12
#include <botan/internal/rotate.h>
13
#include <botan/internal/stl_util.h>
14
15
#include <array>
16
17
namespace Botan {
18
19
namespace {
20
21
/*
22
* RIPEMD-160 F1 Function
23
*/
24
template <size_t S>
25
12.8M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
12.8M
   A += (B ^ C ^ D) + M;
27
12.8M
   A = rotl<S>(A) + E;
28
12.8M
   C = rotl<10>(C);
29
12.8M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<11ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.60M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.60M
   A += (B ^ C ^ D) + M;
27
1.60M
   A = rotl<S>(A) + E;
28
1.60M
   C = rotl<10>(C);
29
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<14ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.20M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.20M
   A += (B ^ C ^ D) + M;
27
1.20M
   A = rotl<S>(A) + E;
28
1.20M
   C = rotl<10>(C);
29
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<15ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.20M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.20M
   A += (B ^ C ^ D) + M;
27
1.20M
   A = rotl<S>(A) + E;
28
1.20M
   C = rotl<10>(C);
29
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<12ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.20M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.20M
   A += (B ^ C ^ D) + M;
27
1.20M
   A = rotl<S>(A) + E;
28
1.20M
   C = rotl<10>(C);
29
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<5ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.60M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.60M
   A += (B ^ C ^ D) + M;
27
1.60M
   A = rotl<S>(A) + E;
28
1.60M
   C = rotl<10>(C);
29
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<8ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.60M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.60M
   A += (B ^ C ^ D) + M;
27
1.60M
   A = rotl<S>(A) + E;
28
1.60M
   C = rotl<10>(C);
29
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<7ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
800k
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
800k
   A += (B ^ C ^ D) + M;
27
800k
   A = rotl<S>(A) + E;
28
800k
   C = rotl<10>(C);
29
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<9ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.20M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.20M
   A += (B ^ C ^ D) + M;
27
1.20M
   A = rotl<S>(A) + E;
28
1.20M
   C = rotl<10>(C);
29
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<13ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.20M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.20M
   A += (B ^ C ^ D) + M;
27
1.20M
   A = rotl<S>(A) + E;
28
1.20M
   C = rotl<10>(C);
29
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F1<6ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
25
1.20M
inline void F1(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
26
1.20M
   A += (B ^ C ^ D) + M;
27
1.20M
   A = rotl<S>(A) + E;
28
1.20M
   C = rotl<10>(C);
29
1.20M
}
30
31
/*
32
* RIPEMD-160 F2 Function
33
*/
34
template <size_t S>
35
12.8M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
12.8M
   A += choose(B, C, D) + M;
37
12.8M
   A = rotl<S>(A) + E;
38
12.8M
   C = rotl<10>(C);
39
12.8M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<7ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.60M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.60M
   A += choose(B, C, D) + M;
37
1.60M
   A = rotl<S>(A) + E;
38
1.60M
   C = rotl<10>(C);
39
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<6ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.20M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.20M
   A += choose(B, C, D) + M;
37
1.20M
   A = rotl<S>(A) + E;
38
1.20M
   C = rotl<10>(C);
39
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<8ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.20M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.20M
   A += choose(B, C, D) + M;
37
1.20M
   A = rotl<S>(A) + E;
38
1.20M
   C = rotl<10>(C);
39
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<13ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
800k
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
800k
   A += choose(B, C, D) + M;
37
800k
   A = rotl<S>(A) + E;
38
800k
   C = rotl<10>(C);
39
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<11ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.20M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.20M
   A += choose(B, C, D) + M;
37
1.20M
   A = rotl<S>(A) + E;
38
1.20M
   C = rotl<10>(C);
39
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<9ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.60M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.60M
   A += choose(B, C, D) + M;
37
1.60M
   A = rotl<S>(A) + E;
38
1.60M
   C = rotl<10>(C);
39
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<15ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.60M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.60M
   A += choose(B, C, D) + M;
37
1.60M
   A = rotl<S>(A) + E;
38
1.60M
   C = rotl<10>(C);
39
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<12ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.60M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.60M
   A += choose(B, C, D) + M;
37
1.60M
   A = rotl<S>(A) + E;
38
1.60M
   C = rotl<10>(C);
39
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<5ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
800k
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
800k
   A += choose(B, C, D) + M;
37
800k
   A = rotl<S>(A) + E;
38
800k
   C = rotl<10>(C);
39
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F2<14ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
35
1.20M
inline void F2(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
36
1.20M
   A += choose(B, C, D) + M;
37
1.20M
   A = rotl<S>(A) + E;
38
1.20M
   C = rotl<10>(C);
39
1.20M
}
40
41
/*
42
* RIPEMD-160 F3 Function
43
*/
44
template <size_t S>
45
12.8M
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
12.8M
   A += (D ^ (B | ~C)) + M;
47
12.8M
   A = rotl<S>(A) + E;
48
12.8M
   C = rotl<10>(C);
49
12.8M
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<11ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
800k
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
800k
   A += (D ^ (B | ~C)) + M;
47
800k
   A = rotl<S>(A) + E;
48
800k
   C = rotl<10>(C);
49
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<9ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
800k
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
800k
   A += (D ^ (B | ~C)) + M;
47
800k
   A = rotl<S>(A) + E;
48
800k
   C = rotl<10>(C);
49
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<13ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
2.40M
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
2.40M
   A += (D ^ (B | ~C)) + M;
47
2.40M
   A = rotl<S>(A) + E;
48
2.40M
   C = rotl<10>(C);
49
2.40M
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<7ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
1.60M
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
1.60M
   A += (D ^ (B | ~C)) + M;
47
1.60M
   A = rotl<S>(A) + E;
48
1.60M
   C = rotl<10>(C);
49
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<6ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
1.60M
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
1.60M
   A += (D ^ (B | ~C)) + M;
47
1.60M
   A = rotl<S>(A) + E;
48
1.60M
   C = rotl<10>(C);
49
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<15ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
800k
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
800k
   A += (D ^ (B | ~C)) + M;
47
800k
   A = rotl<S>(A) + E;
48
800k
   C = rotl<10>(C);
49
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<14ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
1.60M
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
1.60M
   A += (D ^ (B | ~C)) + M;
47
1.60M
   A = rotl<S>(A) + E;
48
1.60M
   C = rotl<10>(C);
49
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<8ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
800k
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
800k
   A += (D ^ (B | ~C)) + M;
47
800k
   A = rotl<S>(A) + E;
48
800k
   C = rotl<10>(C);
49
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<12ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
800k
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
800k
   A += (D ^ (B | ~C)) + M;
47
800k
   A = rotl<S>(A) + E;
48
800k
   C = rotl<10>(C);
49
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F3<5ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
45
1.60M
inline void F3(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
46
1.60M
   A += (D ^ (B | ~C)) + M;
47
1.60M
   A = rotl<S>(A) + E;
48
1.60M
   C = rotl<10>(C);
49
1.60M
}
50
51
/*
52
* RIPEMD-160 F4 Function
53
*/
54
template <size_t S>
55
12.8M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
12.8M
   A += choose(D, B, C) + M;
57
12.8M
   A = rotl<S>(A) + E;
58
12.8M
   C = rotl<10>(C);
59
12.8M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<9ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.60M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.60M
   A += choose(D, B, C) + M;
57
1.60M
   A = rotl<S>(A) + E;
58
1.60M
   C = rotl<10>(C);
59
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<13ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
800k
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
800k
   A += choose(D, B, C) + M;
57
800k
   A = rotl<S>(A) + E;
58
800k
   C = rotl<10>(C);
59
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<15ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.60M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.60M
   A += choose(D, B, C) + M;
57
1.60M
   A = rotl<S>(A) + E;
58
1.60M
   C = rotl<10>(C);
59
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<7ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.60M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.60M
   A += choose(D, B, C) + M;
57
1.60M
   A = rotl<S>(A) + E;
58
1.60M
   C = rotl<10>(C);
59
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<12ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.60M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.60M
   A += choose(D, B, C) + M;
57
1.60M
   A = rotl<S>(A) + E;
58
1.60M
   C = rotl<10>(C);
59
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<8ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.20M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.20M
   A += choose(D, B, C) + M;
57
1.20M
   A = rotl<S>(A) + E;
58
1.20M
   C = rotl<10>(C);
59
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<11ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.20M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.20M
   A += choose(D, B, C) + M;
57
1.20M
   A = rotl<S>(A) + E;
58
1.20M
   C = rotl<10>(C);
59
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<6ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.20M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.20M
   A += choose(D, B, C) + M;
57
1.20M
   A = rotl<S>(A) + E;
58
1.20M
   C = rotl<10>(C);
59
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<14ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
1.20M
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
1.20M
   A += choose(D, B, C) + M;
57
1.20M
   A = rotl<S>(A) + E;
58
1.20M
   C = rotl<10>(C);
59
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F4<5ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
55
800k
inline void F4(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
56
800k
   A += choose(D, B, C) + M;
57
800k
   A = rotl<S>(A) + E;
58
800k
   C = rotl<10>(C);
59
800k
}
60
61
/*
62
* RIPEMD-160 F5 Function
63
*/
64
template <size_t S>
65
12.8M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
12.8M
   A += (B ^ (C | ~D)) + M;
67
12.8M
   A = rotl<S>(A) + E;
68
12.8M
   C = rotl<10>(C);
69
12.8M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<8ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.60M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.60M
   A += (B ^ (C | ~D)) + M;
67
1.60M
   A = rotl<S>(A) + E;
68
1.60M
   C = rotl<10>(C);
69
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<9ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.20M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.20M
   A += (B ^ (C | ~D)) + M;
67
1.20M
   A = rotl<S>(A) + E;
68
1.20M
   C = rotl<10>(C);
69
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<11ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.60M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.60M
   A += (B ^ (C | ~D)) + M;
67
1.60M
   A = rotl<S>(A) + E;
68
1.60M
   C = rotl<10>(C);
69
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<13ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.20M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.20M
   A += (B ^ (C | ~D)) + M;
67
1.20M
   A = rotl<S>(A) + E;
68
1.20M
   C = rotl<10>(C);
69
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<15ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.20M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.20M
   A += (B ^ (C | ~D)) + M;
67
1.20M
   A = rotl<S>(A) + E;
68
1.20M
   C = rotl<10>(C);
69
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<5ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.60M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.60M
   A += (B ^ (C | ~D)) + M;
67
1.60M
   A = rotl<S>(A) + E;
68
1.60M
   C = rotl<10>(C);
69
1.60M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<7ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
800k
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
800k
   A += (B ^ (C | ~D)) + M;
67
800k
   A = rotl<S>(A) + E;
68
800k
   C = rotl<10>(C);
69
800k
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<14ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.20M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.20M
   A += (B ^ (C | ~D)) + M;
67
1.20M
   A = rotl<S>(A) + E;
68
1.20M
   C = rotl<10>(C);
69
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<12ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.20M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.20M
   A += (B ^ (C | ~D)) + M;
67
1.20M
   A = rotl<S>(A) + E;
68
1.20M
   C = rotl<10>(C);
69
1.20M
}
rmd160.cpp:void Botan::(anonymous namespace)::F5<6ul>(unsigned int&, unsigned int, unsigned int&, unsigned int, unsigned int, unsigned int)
Line
Count
Source
65
1.20M
inline void F5(uint32_t& A, uint32_t B, uint32_t& C, uint32_t D, uint32_t E, uint32_t M) {
66
1.20M
   A += (B ^ (C | ~D)) + M;
67
1.20M
   A = rotl<S>(A) + E;
68
1.20M
   C = rotl<10>(C);
69
1.20M
}
70
71
}  // namespace
72
73
/*
74
* RIPEMD-160 Compression Function
75
*/
76
24.1k
void RIPEMD_160::compress_n(digest_type& digest, std::span<const uint8_t> input, size_t blocks) {
77
24.1k
   const uint32_t MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1, MAGIC4 = 0x8F1BBCDC, MAGIC5 = 0xA953FD4E,
78
24.1k
                  MAGIC6 = 0x50A28BE6, MAGIC7 = 0x5C4DD124, MAGIC8 = 0x6D703EF3, MAGIC9 = 0x7A6D76E9;
79
24.1k
   std::array<uint32_t, 16> M;
80
81
24.1k
   BufferSlicer in(input);
82
83
424k
   for(size_t i = 0; i != blocks; ++i) {
84
400k
      load_le(M.data(), in.take(block_bytes).data(), M.size());
85
86
400k
      uint32_t A1 = digest[0], A2 = A1, B1 = digest[1], B2 = B1, C1 = digest[2], C2 = C1, D1 = digest[3], D2 = D1,
87
400k
               E1 = digest[4], E2 = E1;
88
89
400k
      F1<11>(A1, B1, C1, D1, E1, M[0]);
90
400k
      F5<8>(A2, B2, C2, D2, E2, M[5] + MAGIC6);
91
400k
      F1<14>(E1, A1, B1, C1, D1, M[1]);
92
400k
      F5<9>(E2, A2, B2, C2, D2, M[14] + MAGIC6);
93
400k
      F1<15>(D1, E1, A1, B1, C1, M[2]);
94
400k
      F5<9>(D2, E2, A2, B2, C2, M[7] + MAGIC6);
95
400k
      F1<12>(C1, D1, E1, A1, B1, M[3]);
96
400k
      F5<11>(C2, D2, E2, A2, B2, M[0] + MAGIC6);
97
400k
      F1<5>(B1, C1, D1, E1, A1, M[4]);
98
400k
      F5<13>(B2, C2, D2, E2, A2, M[9] + MAGIC6);
99
400k
      F1<8>(A1, B1, C1, D1, E1, M[5]);
100
400k
      F5<15>(A2, B2, C2, D2, E2, M[2] + MAGIC6);
101
400k
      F1<7>(E1, A1, B1, C1, D1, M[6]);
102
400k
      F5<15>(E2, A2, B2, C2, D2, M[11] + MAGIC6);
103
400k
      F1<9>(D1, E1, A1, B1, C1, M[7]);
104
400k
      F5<5>(D2, E2, A2, B2, C2, M[4] + MAGIC6);
105
400k
      F1<11>(C1, D1, E1, A1, B1, M[8]);
106
400k
      F5<7>(C2, D2, E2, A2, B2, M[13] + MAGIC6);
107
400k
      F1<13>(B1, C1, D1, E1, A1, M[9]);
108
400k
      F5<7>(B2, C2, D2, E2, A2, M[6] + MAGIC6);
109
400k
      F1<14>(A1, B1, C1, D1, E1, M[10]);
110
400k
      F5<8>(A2, B2, C2, D2, E2, M[15] + MAGIC6);
111
400k
      F1<15>(E1, A1, B1, C1, D1, M[11]);
112
400k
      F5<11>(E2, A2, B2, C2, D2, M[8] + MAGIC6);
113
400k
      F1<6>(D1, E1, A1, B1, C1, M[12]);
114
400k
      F5<14>(D2, E2, A2, B2, C2, M[1] + MAGIC6);
115
400k
      F1<7>(C1, D1, E1, A1, B1, M[13]);
116
400k
      F5<14>(C2, D2, E2, A2, B2, M[10] + MAGIC6);
117
400k
      F1<9>(B1, C1, D1, E1, A1, M[14]);
118
400k
      F5<12>(B2, C2, D2, E2, A2, M[3] + MAGIC6);
119
400k
      F1<8>(A1, B1, C1, D1, E1, M[15]);
120
400k
      F5<6>(A2, B2, C2, D2, E2, M[12] + MAGIC6);
121
122
400k
      F2<7>(E1, A1, B1, C1, D1, M[7] + MAGIC2);
123
400k
      F4<9>(E2, A2, B2, C2, D2, M[6] + MAGIC7);
124
400k
      F2<6>(D1, E1, A1, B1, C1, M[4] + MAGIC2);
125
400k
      F4<13>(D2, E2, A2, B2, C2, M[11] + MAGIC7);
126
400k
      F2<8>(C1, D1, E1, A1, B1, M[13] + MAGIC2);
127
400k
      F4<15>(C2, D2, E2, A2, B2, M[3] + MAGIC7);
128
400k
      F2<13>(B1, C1, D1, E1, A1, M[1] + MAGIC2);
129
400k
      F4<7>(B2, C2, D2, E2, A2, M[7] + MAGIC7);
130
400k
      F2<11>(A1, B1, C1, D1, E1, M[10] + MAGIC2);
131
400k
      F4<12>(A2, B2, C2, D2, E2, M[0] + MAGIC7);
132
400k
      F2<9>(E1, A1, B1, C1, D1, M[6] + MAGIC2);
133
400k
      F4<8>(E2, A2, B2, C2, D2, M[13] + MAGIC7);
134
400k
      F2<7>(D1, E1, A1, B1, C1, M[15] + MAGIC2);
135
400k
      F4<9>(D2, E2, A2, B2, C2, M[5] + MAGIC7);
136
400k
      F2<15>(C1, D1, E1, A1, B1, M[3] + MAGIC2);
137
400k
      F4<11>(C2, D2, E2, A2, B2, M[10] + MAGIC7);
138
400k
      F2<7>(B1, C1, D1, E1, A1, M[12] + MAGIC2);
139
400k
      F4<7>(B2, C2, D2, E2, A2, M[14] + MAGIC7);
140
400k
      F2<12>(A1, B1, C1, D1, E1, M[0] + MAGIC2);
141
400k
      F4<7>(A2, B2, C2, D2, E2, M[15] + MAGIC7);
142
400k
      F2<15>(E1, A1, B1, C1, D1, M[9] + MAGIC2);
143
400k
      F4<12>(E2, A2, B2, C2, D2, M[8] + MAGIC7);
144
400k
      F2<9>(D1, E1, A1, B1, C1, M[5] + MAGIC2);
145
400k
      F4<7>(D2, E2, A2, B2, C2, M[12] + MAGIC7);
146
400k
      F2<11>(C1, D1, E1, A1, B1, M[2] + MAGIC2);
147
400k
      F4<6>(C2, D2, E2, A2, B2, M[4] + MAGIC7);
148
400k
      F2<7>(B1, C1, D1, E1, A1, M[14] + MAGIC2);
149
400k
      F4<15>(B2, C2, D2, E2, A2, M[9] + MAGIC7);
150
400k
      F2<13>(A1, B1, C1, D1, E1, M[11] + MAGIC2);
151
400k
      F4<13>(A2, B2, C2, D2, E2, M[1] + MAGIC7);
152
400k
      F2<12>(E1, A1, B1, C1, D1, M[8] + MAGIC2);
153
400k
      F4<11>(E2, A2, B2, C2, D2, M[2] + MAGIC7);
154
155
400k
      F3<11>(D1, E1, A1, B1, C1, M[3] + MAGIC3);
156
400k
      F3<9>(D2, E2, A2, B2, C2, M[15] + MAGIC8);
157
400k
      F3<13>(C1, D1, E1, A1, B1, M[10] + MAGIC3);
158
400k
      F3<7>(C2, D2, E2, A2, B2, M[5] + MAGIC8);
159
400k
      F3<6>(B1, C1, D1, E1, A1, M[14] + MAGIC3);
160
400k
      F3<15>(B2, C2, D2, E2, A2, M[1] + MAGIC8);
161
400k
      F3<7>(A1, B1, C1, D1, E1, M[4] + MAGIC3);
162
400k
      F3<11>(A2, B2, C2, D2, E2, M[3] + MAGIC8);
163
400k
      F3<14>(E1, A1, B1, C1, D1, M[9] + MAGIC3);
164
400k
      F3<8>(E2, A2, B2, C2, D2, M[7] + MAGIC8);
165
400k
      F3<9>(D1, E1, A1, B1, C1, M[15] + MAGIC3);
166
400k
      F3<6>(D2, E2, A2, B2, C2, M[14] + MAGIC8);
167
400k
      F3<13>(C1, D1, E1, A1, B1, M[8] + MAGIC3);
168
400k
      F3<6>(C2, D2, E2, A2, B2, M[6] + MAGIC8);
169
400k
      F3<15>(B1, C1, D1, E1, A1, M[1] + MAGIC3);
170
400k
      F3<14>(B2, C2, D2, E2, A2, M[9] + MAGIC8);
171
400k
      F3<14>(A1, B1, C1, D1, E1, M[2] + MAGIC3);
172
400k
      F3<12>(A2, B2, C2, D2, E2, M[11] + MAGIC8);
173
400k
      F3<8>(E1, A1, B1, C1, D1, M[7] + MAGIC3);
174
400k
      F3<13>(E2, A2, B2, C2, D2, M[8] + MAGIC8);
175
400k
      F3<13>(D1, E1, A1, B1, C1, M[0] + MAGIC3);
176
400k
      F3<5>(D2, E2, A2, B2, C2, M[12] + MAGIC8);
177
400k
      F3<6>(C1, D1, E1, A1, B1, M[6] + MAGIC3);
178
400k
      F3<14>(C2, D2, E2, A2, B2, M[2] + MAGIC8);
179
400k
      F3<5>(B1, C1, D1, E1, A1, M[13] + MAGIC3);
180
400k
      F3<13>(B2, C2, D2, E2, A2, M[10] + MAGIC8);
181
400k
      F3<12>(A1, B1, C1, D1, E1, M[11] + MAGIC3);
182
400k
      F3<13>(A2, B2, C2, D2, E2, M[0] + MAGIC8);
183
400k
      F3<7>(E1, A1, B1, C1, D1, M[5] + MAGIC3);
184
400k
      F3<7>(E2, A2, B2, C2, D2, M[4] + MAGIC8);
185
400k
      F3<5>(D1, E1, A1, B1, C1, M[12] + MAGIC3);
186
400k
      F3<5>(D2, E2, A2, B2, C2, M[13] + MAGIC8);
187
188
400k
      F4<11>(C1, D1, E1, A1, B1, M[1] + MAGIC4);
189
400k
      F2<15>(C2, D2, E2, A2, B2, M[8] + MAGIC9);
190
400k
      F4<12>(B1, C1, D1, E1, A1, M[9] + MAGIC4);
191
400k
      F2<5>(B2, C2, D2, E2, A2, M[6] + MAGIC9);
192
400k
      F4<14>(A1, B1, C1, D1, E1, M[11] + MAGIC4);
193
400k
      F2<8>(A2, B2, C2, D2, E2, M[4] + MAGIC9);
194
400k
      F4<15>(E1, A1, B1, C1, D1, M[10] + MAGIC4);
195
400k
      F2<11>(E2, A2, B2, C2, D2, M[1] + MAGIC9);
196
400k
      F4<14>(D1, E1, A1, B1, C1, M[0] + MAGIC4);
197
400k
      F2<14>(D2, E2, A2, B2, C2, M[3] + MAGIC9);
198
400k
      F4<15>(C1, D1, E1, A1, B1, M[8] + MAGIC4);
199
400k
      F2<14>(C2, D2, E2, A2, B2, M[11] + MAGIC9);
200
400k
      F4<9>(B1, C1, D1, E1, A1, M[12] + MAGIC4);
201
400k
      F2<6>(B2, C2, D2, E2, A2, M[15] + MAGIC9);
202
400k
      F4<8>(A1, B1, C1, D1, E1, M[4] + MAGIC4);
203
400k
      F2<14>(A2, B2, C2, D2, E2, M[0] + MAGIC9);
204
400k
      F4<9>(E1, A1, B1, C1, D1, M[13] + MAGIC4);
205
400k
      F2<6>(E2, A2, B2, C2, D2, M[5] + MAGIC9);
206
400k
      F4<14>(D1, E1, A1, B1, C1, M[3] + MAGIC4);
207
400k
      F2<9>(D2, E2, A2, B2, C2, M[12] + MAGIC9);
208
400k
      F4<5>(C1, D1, E1, A1, B1, M[7] + MAGIC4);
209
400k
      F2<12>(C2, D2, E2, A2, B2, M[2] + MAGIC9);
210
400k
      F4<6>(B1, C1, D1, E1, A1, M[15] + MAGIC4);
211
400k
      F2<9>(B2, C2, D2, E2, A2, M[13] + MAGIC9);
212
400k
      F4<8>(A1, B1, C1, D1, E1, M[14] + MAGIC4);
213
400k
      F2<12>(A2, B2, C2, D2, E2, M[9] + MAGIC9);
214
400k
      F4<6>(E1, A1, B1, C1, D1, M[5] + MAGIC4);
215
400k
      F2<5>(E2, A2, B2, C2, D2, M[7] + MAGIC9);
216
400k
      F4<5>(D1, E1, A1, B1, C1, M[6] + MAGIC4);
217
400k
      F2<15>(D2, E2, A2, B2, C2, M[10] + MAGIC9);
218
400k
      F4<12>(C1, D1, E1, A1, B1, M[2] + MAGIC4);
219
400k
      F2<8>(C2, D2, E2, A2, B2, M[14] + MAGIC9);
220
221
400k
      F5<9>(B1, C1, D1, E1, A1, M[4] + MAGIC5);
222
400k
      F1<8>(B2, C2, D2, E2, A2, M[12]);
223
400k
      F5<15>(A1, B1, C1, D1, E1, M[0] + MAGIC5);
224
400k
      F1<5>(A2, B2, C2, D2, E2, M[15]);
225
400k
      F5<5>(E1, A1, B1, C1, D1, M[5] + MAGIC5);
226
400k
      F1<12>(E2, A2, B2, C2, D2, M[10]);
227
400k
      F5<11>(D1, E1, A1, B1, C1, M[9] + MAGIC5);
228
400k
      F1<9>(D2, E2, A2, B2, C2, M[4]);
229
400k
      F5<6>(C1, D1, E1, A1, B1, M[7] + MAGIC5);
230
400k
      F1<12>(C2, D2, E2, A2, B2, M[1]);
231
400k
      F5<8>(B1, C1, D1, E1, A1, M[12] + MAGIC5);
232
400k
      F1<5>(B2, C2, D2, E2, A2, M[5]);
233
400k
      F5<13>(A1, B1, C1, D1, E1, M[2] + MAGIC5);
234
400k
      F1<14>(A2, B2, C2, D2, E2, M[8]);
235
400k
      F5<12>(E1, A1, B1, C1, D1, M[10] + MAGIC5);
236
400k
      F1<6>(E2, A2, B2, C2, D2, M[7]);
237
400k
      F5<5>(D1, E1, A1, B1, C1, M[14] + MAGIC5);
238
400k
      F1<8>(D2, E2, A2, B2, C2, M[6]);
239
400k
      F5<12>(C1, D1, E1, A1, B1, M[1] + MAGIC5);
240
400k
      F1<13>(C2, D2, E2, A2, B2, M[2]);
241
400k
      F5<13>(B1, C1, D1, E1, A1, M[3] + MAGIC5);
242
400k
      F1<6>(B2, C2, D2, E2, A2, M[13]);
243
400k
      F5<14>(A1, B1, C1, D1, E1, M[8] + MAGIC5);
244
400k
      F1<5>(A2, B2, C2, D2, E2, M[14]);
245
400k
      F5<11>(E1, A1, B1, C1, D1, M[11] + MAGIC5);
246
400k
      F1<15>(E2, A2, B2, C2, D2, M[0]);
247
400k
      F5<8>(D1, E1, A1, B1, C1, M[6] + MAGIC5);
248
400k
      F1<13>(D2, E2, A2, B2, C2, M[3]);
249
400k
      F5<5>(C1, D1, E1, A1, B1, M[15] + MAGIC5);
250
400k
      F1<11>(C2, D2, E2, A2, B2, M[9]);
251
400k
      F5<6>(B1, C1, D1, E1, A1, M[13] + MAGIC5);
252
400k
      F1<11>(B2, C2, D2, E2, A2, M[11]);
253
254
400k
      C1 = digest[1] + C1 + D2;
255
400k
      digest[1] = digest[2] + D1 + E2;
256
400k
      digest[2] = digest[3] + E1 + A2;
257
400k
      digest[3] = digest[4] + A1 + B2;
258
400k
      digest[4] = digest[0] + B1 + C2;
259
400k
      digest[0] = C1;
260
400k
   }
261
24.1k
}
262
263
20.2k
void RIPEMD_160::init(digest_type& digest) {
264
20.2k
   digest.assign({0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0});
265
20.2k
}
266
267
0
std::unique_ptr<HashFunction> RIPEMD_160::new_object() const {
268
0
   return std::make_unique<RIPEMD_160>();
269
0
}
270
271
0
std::unique_ptr<HashFunction> RIPEMD_160::copy_state() const {
272
0
   return std::make_unique<RIPEMD_160>(*this);
273
0
}
274
275
70.5k
void RIPEMD_160::add_data(std::span<const uint8_t> input) {
276
70.5k
   m_md.update(input);
277
70.5k
}
278
279
6.55k
void RIPEMD_160::final_result(std::span<uint8_t> output) {
280
6.55k
   m_md.final(output);
281
6.55k
}
282
283
}  // namespace Botan