Skip to content

Commit 568655d

Browse files
committed
Rename to num_winternitz_chains
1 parent 8e67e43 commit 568655d

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ The following table shows the mapping between the RFC and the library naming inc
4141

4242
| RFC Naming | Library Naming | Meaning |
4343
|------------|----------------------|-----------------------------------------------------------|
44-
| I | lms_tree_identifier | 16-byte random value to identify a single LMS tree |
45-
| q | lms_leaf_identifier | 4-byte value to identify all leafs in a single LMS tree |
46-
| C | signature_randomizer | 32-byte random value added to every signature |
47-
| Q | message_hash | Output of hashed message together with I, q, D_MESG and C |
48-
| y | signature_data | The actual data of the signature |
49-
| p | hash_chain_count | The number of hash chains for a certain W parameter |
50-
| ls | checksum_left_shift | How many bits the checksum is shifted into the coef-value |
51-
| n | hash_function_output_size | Number of bytes that the lm_ots hash functions generates |
52-
| m | hash_function_output_size | Number of bytes that the lms hash functions generates |
44+
| I | lms_tree_identifier | 16-byte random value to identify a single LMS tree |
45+
| q | lms_leaf_identifier | 4-byte value to identify all leafs in a single LMS tree |
46+
| C | signature_randomizer | 32-byte random value added to every signature |
47+
| Q | message_hash | Output of hashed message together with I, q, D_MESG and C |
48+
| y | signature_data | The actual data of the signature |
49+
| p | num_winternitz_chains | The number of hash chains for a certain W parameter |
50+
| ls | checksum_left_shift | How many bits the checksum is shifted into the coef-value |
51+
| n | hash_function_output_size | Number of bytes that the lm_ots hash functions generates |
52+
| m | hash_function_output_size | Number of bytes that the lms hash functions generates |
5353

5454
## Minimum Supported Rust Version
5555
The crate in this repository supports Rust **1.63** or higher.

src/lm_ots/keygen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn generate_public_key<H: HashChain>(private_key: &LmotsPrivateKey<H>) -> Lm
3838
let lmots_parameter = &private_key.lmots_parameter;
3939
let mut hasher = lmots_parameter.get_hasher();
4040

41-
let hash_chain_count: usize = 2_usize.pow(lmots_parameter.get_winternitz() as u32) - 1;
41+
let num_winternitz_chains: usize = 2_usize.pow(lmots_parameter.get_winternitz() as u32) - 1;
4242
let key = &private_key.key;
4343

4444
let mut public_key_data: ArrayVec<[ArrayVec<[u8; MAX_HASH_SIZE]>; MAX_NUM_WINTERNITZ_CHAINS]> =
@@ -54,7 +54,7 @@ pub fn generate_public_key<H: HashChain>(private_key: &LmotsPrivateKey<H>) -> Lm
5454
i as u16,
5555
key[i].as_slice(),
5656
0,
57-
hash_chain_count,
57+
num_winternitz_chains,
5858
);
5959

6060
public_key_data.push(result);

src/lm_ots/parameters.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl LmotsAlgorithm {
8484
pub struct LmotsParameter<H: HashChain> {
8585
type_id: u32,
8686
winternitz: u8,
87-
hash_chain_count: u16,
87+
num_winternitz_chains: u16,
8888
checksum_left_shift: u8,
8989
phantom_data: PhantomData<H>,
9090
}
@@ -99,13 +99,13 @@ impl<H: HashChain> LmotsParameter<H> {
9999
pub fn new(
100100
type_id: u32,
101101
winternitz: u8,
102-
hash_chain_count: u16,
102+
num_winternitz_chains: u16,
103103
checksum_left_shift: u8,
104104
) -> Self {
105105
Self {
106106
type_id,
107107
winternitz,
108-
hash_chain_count,
108+
num_winternitz_chains,
109109
checksum_left_shift,
110110
phantom_data: PhantomData,
111111
}
@@ -120,7 +120,7 @@ impl<H: HashChain> LmotsParameter<H> {
120120
}
121121

122122
pub fn get_num_winternitz_chains(&self) -> u16 {
123-
self.hash_chain_count
123+
self.num_winternitz_chains
124124
}
125125

126126
pub fn get_checksum_left_shift(&self) -> u8 {

src/lm_ots/signing.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,11 @@ mod tests {
381381

382382
// check signature len
383383
let output_size = lmots_parameter.get_hash_function_output_size() as usize;
384-
let hash_chain_count = lmots_parameter.get_num_winternitz_chains() as usize;
385-
assert_eq!(binary_rep.len(), 4 + output_size * (hash_chain_count + 1));
384+
let num_winternitz_chains = lmots_parameter.get_num_winternitz_chains() as usize;
385+
assert_eq!(
386+
binary_rep.len(),
387+
4 + output_size * (num_winternitz_chains + 1)
388+
);
386389

387390
let deserialized_signature = InMemoryLmotsSignature::new(binary_rep.as_slice())
388391
.expect("Deserialization must succeed.");

0 commit comments

Comments
 (0)