1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/// Performs a right rotation on a 32-bit value
///
/// This is a constant-time operation used in SHA-256 hash computation.
///
/// # Arguments
///
/// * `x` - The value to rotate
/// * `n` - The number of positions to rotate right
///
/// # Returns
///
/// The rotated value
pub const
/// Computes the Σ₀ (sigma0) function used in SHA-256
///
/// Σ₀(x) = ROTR²(x) ⊕ ROTR¹³(x) ⊕ ROTR²²(x)
///
/// # Arguments
///
/// * `x` - The input value
///
/// # Returns
///
/// The result of the Σ₀ function
pub const
/// Computes the Σ₁ (sigma1) function used in SHA-256
///
/// Σ₁(x) = ROTR⁶(x) ⊕ ROTR¹¹(x) ⊕ ROTR²⁵(x)
///
/// # Arguments
///
/// * `x` - The input value
///
/// # Returns
///
/// The result of the Σ₁ function
pub const
/// Computes the σ₀ (lowercase sigma0) function used in SHA-256
///
/// σ₀(x) = ROTR⁷(x) ⊕ ROTR¹⁸(x) ⊕ SHR³(x)
///
/// # Arguments
///
/// * `x` - The input value
///
/// # Returns
///
/// The result of the σ₀ function
pub const
/// Computes the σ₁ (lowercase sigma1) function used in SHA-256
///
/// σ₁(x) = ROTR¹⁷(x) ⊕ ROTR¹⁹(x) ⊕ SHR¹⁰(x)
///
/// # Arguments
///
/// * `x` - The input value
///
/// # Returns
///
/// The result of the σ₁ function
pub const
/// Computes the Ch (choose) function used in SHA-256
///
/// Ch(x,y,z) = (x ∧ y) ⊕ (¬x ∧ z)
///
/// This function chooses bits from y or z based on x.
///
/// # Arguments
///
/// * `x` - The selector value
/// * `y` - First input value
/// * `z` - Second input value
///
/// # Returns
///
/// The result of the Ch function
pub const
/// Computes the Maj (majority) function used in SHA-256
///
/// Maj(x,y,z) = (x ∧ y) ⊕ (x ∧ z) ⊕ (y ∧ z)
///
/// This function returns the majority value of each bit position.
///
/// # Arguments
///
/// * `x` - First input value
/// * `y` - Second input value
/// * `z` - Third input value
///
/// # Returns
///
/// The result of the Maj function
pub const