poseidon_parameters/round_numbers.rs
1/// `RoundNumbers` required for security based on known attacks.
2#[derive(Copy, Clone, Debug, PartialEq, Eq)]
3pub struct RoundNumbers {
4 /// Number of partial rounds.
5 pub r_P: usize,
6 /// Number of full rounds.
7 pub r_F: usize,
8}
9
10impl RoundNumbers {
11 /// Number of full rounds.
12 pub fn full(&self) -> usize {
13 self.r_F
14 }
15
16 /// Number of full rounds as mutable reference.
17 pub fn full_mut(&mut self) -> &mut usize {
18 &mut self.r_F
19 }
20
21 /// Number of partial rounds.
22 pub fn partial(&self) -> usize {
23 self.r_P
24 }
25
26 /// Number of full rounds as mutable reference.
27 pub fn partial_mut(&mut self) -> &mut usize {
28 &mut self.r_P
29 }
30
31 /// Number of total rounds.
32 pub fn total(&self) -> usize {
33 self.r_P + self.r_F
34 }
35}