feat: intialize cargo features in post-quantum to use signature schemes based on feature#791
Conversation
| const LOG_LIFETIME: usize = 8; | ||
| const DIMENSION: usize = 16; | ||
| const BASE: usize = 4; | ||
| const FINAL_LAYER: usize = 24; | ||
| const TARGET_SUM: usize = 24; | ||
|
|
||
| const PARAMETER_LEN: usize = 5; | ||
| const TWEAK_LEN_FE: usize = 2; | ||
| const MSG_LEN_FE: usize = 9; | ||
| const RAND_LEN_FE: usize = 7; | ||
| const HASH_LEN_FE: usize = 8; | ||
|
|
||
| const CAPACITY: usize = 9; | ||
|
|
||
| const POS_OUTPUT_LEN_PER_INV_FE: usize = 15; | ||
| const POS_INVOCATIONS: usize = 1; | ||
| const POS_OUTPUT_LEN_FE: usize = POS_OUTPUT_LEN_PER_INV_FE * POS_INVOCATIONS; | ||
|
|
||
| type MH = TopLevelPoseidonMessageHash< | ||
| POS_OUTPUT_LEN_PER_INV_FE, | ||
| POS_INVOCATIONS, | ||
| POS_OUTPUT_LEN_FE, | ||
| DIMENSION, | ||
| BASE, | ||
| FINAL_LAYER, | ||
| TWEAK_LEN_FE, | ||
| MSG_LEN_FE, | ||
| PARAMETER_LEN, | ||
| RAND_LEN_FE, | ||
| >; | ||
| type TH = PoseidonTweakHash<PARAMETER_LEN, HASH_LEN_FE, TWEAK_LEN_FE, CAPACITY, DIMENSION>; | ||
|
|
||
| #[allow(clippy::upper_case_acronyms)] | ||
| type PRF = ShakePRFtoF<HASH_LEN_FE>; | ||
|
|
||
| type IE = TargetSumEncoding<MH, TARGET_SUM>; |
There was a problem hiding this comment.
is it possible to use more descriptive const and type names
There was a problem hiding this comment.
Looks better now.
There was a problem hiding this comment.
IMHO it seems better to follow what hash-sig does: https://github.com/b-wagn/hash-sig/blob/84dd4564a17383c154d0e4c25a248c601a1b8914/src/signature/generalized_xmss/instantiations_poseidon_top_level.rs#L11-L47
crate/crypto/post_quantum/src/hashsig is totally dependent on hash-sig library, which means if we use different notation, it might be confusing.
There was a problem hiding this comment.
I don't know why we would follow naming paradigms decided on by researchers (often not known for readable names). what is confusing is seeing FE, what does it stand for Fan Edition? https://www.samsung.com/uk/mobile-phone-buying-guide/what-is-samsung-fe/
I don't see how using more descriptive names would make it more confusing
There was a problem hiding this comment.
I don't want to read a math proof etc etc, leave the x,y,z's for the papers
There was a problem hiding this comment.
IE = internet explorer?, etc
What was wrong?
Fixes: #771
How was it fixed?
I initially tried using an enum to select the signature scheme and then trying to use a config.rs file to set a PROD or TEST or some other config.
I found those to be unclean solutions so I then moved to looking into cargo features. I found that to be a pretty clean solution to making hash-sig configurable.
I am looking for input for this approach from @syjn99 and @KolbyML. I shall add some more documentation if this is good.
To-Do