Skip to main content

PartialRoundBaseParameters

Trait PartialRoundBaseParameters 

Source
pub trait PartialRoundBaseParameters<MP: MontyParameters, const WIDTH: usize>: Clone + Sync {
    const USE_TEXTBOOK: bool = false;

    // Provided method
    fn mds_permute(_state: &mut [MontyField31<MP>; WIDTH]) { ... }
}
Expand description

Trait for Poseidon1 partial round scalar operations.

Provides compile-time dispatch between two partial round strategies:

  • Sparse decomposition (USE_TEXTBOOK = false, default): Uses the sparse matrix factorization from Appendix B of the Poseidon1 paper. Best for most field/width combos.

  • Textbook with scalar constants (USE_TEXTBOOK = true): Keeps the fast MDS permutation (e.g., Karatsuba convolution) per round, but folds state[1..WIDTH] constants forward so only a scalar is added to state[0] each round. Best when the MDS is very fast (e.g., BabyBear width-16 with power-of-2 Karatsuba).

Provided Associated Constants§

Source

const USE_TEXTBOOK: bool = false

Whether to use the textbook (MDS-per-round) path for partial rounds.

  • When true, the Karatsuba MDS is applied per round with scalar constants.
  • When false (default), the sparse matrix decomposition is used.

Provided Methods§

Source

fn mds_permute(_state: &mut [MontyField31<MP>; WIDTH])

Apply the MDS permutation. Only called when USE_TEXTBOOK is true.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§