pub struct Level5;Expand description
NIST Security Level V (256-bit post-quantum security).
Prime: p = 27 * 2^500 - 1, encoded in 64 bytes.
Trait Implementations§
Source§impl FpBackend for Level5
impl FpBackend for Level5
Source§fn set_small(out: &mut Array<u64, Self::FpLimbs>, val: u64)
fn set_small(out: &mut Array<u64, Self::FpLimbs>, val: u64)
out <- val in Montgomery form, treating val as an unsigned
integer that fits in the field.Source§fn is_equal(
a: &Array<u64, Self::FpLimbs>,
b: &Array<u64, Self::FpLimbs>,
) -> Choice
fn is_equal( a: &Array<u64, Self::FpLimbs>, b: &Array<u64, Self::FpLimbs>, ) -> Choice
Choice(1) if a == b
(after full reduction), Choice(0) otherwise.Source§fn is_zero(a: &Array<u64, Self::FpLimbs>) -> Choice
fn is_zero(a: &Array<u64, Self::FpLimbs>) -> Choice
Choice(1) if a == 0
(after full reduction), Choice(0) otherwise.Source§fn add(
out: &mut Array<u64, Self::FpLimbs>,
a: &Array<u64, Self::FpLimbs>,
b: &Array<u64, Self::FpLimbs>,
)
fn add( out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>, b: &Array<u64, Self::FpLimbs>, )
out <- a + b mod 2p.Source§fn sub(
out: &mut Array<u64, Self::FpLimbs>,
a: &Array<u64, Self::FpLimbs>,
b: &Array<u64, Self::FpLimbs>,
)
fn sub( out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>, b: &Array<u64, Self::FpLimbs>, )
out <- a - b mod 2p.Source§fn mul(
out: &mut Array<u64, Self::FpLimbs>,
a: &Array<u64, Self::FpLimbs>,
b: &Array<u64, Self::FpLimbs>,
)
fn mul( out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>, b: &Array<u64, Self::FpLimbs>, )
Source§fn sqr(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
fn sqr(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
Source§fn inv(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
fn inv(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
out <- 1 / a mod p. If a == 0 the output is 0 (no panic).Source§fn sqrt(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
fn sqrt(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
out <- sqrt(a) mod p. The caller is responsible for ensuring
a is a quadratic residue; on non-QR inputs the output is
well-defined but is not a square root of a. The result is
determined only up to sign.Source§fn is_square(a: &Array<u64, Self::FpLimbs>) -> Choice
fn is_square(a: &Array<u64, Self::FpLimbs>) -> Choice
Choice(1) if a is a quadratic residue (or zero) in
Fp, Choice(0) otherwise.Source§fn half(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
fn half(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
out <- a / 2 mod p.Source§fn div3(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
fn div3(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
out <- a / 3 mod p.Source§fn exp3div4(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
fn exp3div4(out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>)
out <- a^((p-3)/4) mod p. Combined
with one extra multiplication this yields sqrt(a) when p = 3 mod 4.Source§fn mul_small(
out: &mut Array<u64, Self::FpLimbs>,
a: &Array<u64, Self::FpLimbs>,
val: u32,
)
fn mul_small( out: &mut Array<u64, Self::FpLimbs>, a: &Array<u64, Self::FpLimbs>, val: u32, )
out <- a * val mod 2p for a small (32-bit) integer multiplier.Source§fn encode(out: &mut [u8], a: &Array<u64, Self::FpLimbs>)
fn encode(out: &mut [u8], a: &Array<u64, Self::FpLimbs>)
a to its canonical little-endian byte form. Writes
exactly Self::FpEncodedBytes::USIZE bytes.Source§fn decode(out: &mut Array<u64, Self::FpLimbs>, bytes: &[u8]) -> Choice
fn decode(out: &mut Array<u64, Self::FpLimbs>, bytes: &[u8]) -> Choice
Fp element from Self::FpEncodedBytes::USIZE
canonical little-endian bytes. Returns Choice(1) if the input
represented an integer in [0, p), Choice(0) otherwise. On
out-of-range input the output is zeroed.Source§fn decode_reduce(out: &mut Array<u64, Self::FpLimbs>, bytes: &[u8])
fn decode_reduce(out: &mut Array<u64, Self::FpLimbs>, bytes: &[u8])
Source§impl LevelPrecomp for Level5
impl LevelPrecomp for Level5
Source§fn basis_e0_px_bytes() -> &'static [u8]
fn basis_e0_px_bytes() -> &'static [u8]
Source§fn basis_e0_qx_bytes() -> &'static [u8]
fn basis_e0_qx_bytes() -> &'static [u8]
Source§fn p_cofactor_for_2f() -> &'static [u64]
fn p_cofactor_for_2f() -> &'static [u64]
Source§fn p_cofactor_for_2f_bitlength() -> u32
fn p_cofactor_for_2f_bitlength() -> u32
Source§fn torsion_even_power() -> u32
fn torsion_even_power() -> u32
Source§fn splitting_transforms() -> &'static [[[u8; 4]; 4]; 10]
fn splitting_transforms() -> &'static [[[u8; 4]; 4]; 10]
Source§impl SecurityLevel for Level5
impl SecurityLevel for Level5
Source§const HASH_ITERATIONS: u32 = 512
const HASH_ITERATIONS: u32 = 512
Up to 512 SHAKE256 squeeze attempts to find a valid challenge.
Source§const NWORDS_ORDER: usize = 8
const NWORDS_ORDER: usize = 8
8 limbs × 64 = 512-bit scalar width.
Source§const TORSION_EVEN_POWER: u32 = 500
const TORSION_EVEN_POWER: u32 = 500
v_2(p + 1) = 500.
Source§const P_COFACTOR_FOR_2F_BITLENGTH: usize = 5
const P_COFACTOR_FOR_2F_BITLENGTH: usize = 5
(p + 1) / 2^500 = 27 = 0b11011, which is 5 bits.
Source§const SQISIGN_RESPONSE_LENGTH: u32 = 253
const SQISIGN_RESPONSE_LENGTH: u32 = 253
Response isogeny length = 253 bits (same as E_RSP).
Source§type FpLimbs = UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>
type FpLimbs = UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>
9 limbs × 57-bit radix = 513 bits of storage for the 505-bit prime.
Source§type MpLimbs = UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>
type MpLimbs = UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>
8 limbs × 64 bits = 512-bit scalars for order arithmetic.
Source§type FpEncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>
type FpEncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>
p fits in 64 bytes (505 bits).
Source§type Fp2EncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
type Fp2EncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
Two Fp elements = 128 bytes.
Source§type PkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B1>
type PkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B1>
Public key: 1-byte header + 2 × 64 bytes for the Fp2 j-invariant.
Source§type SigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B0>, B0>, B1>, B0>, B0>
type SigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B0>, B0>, B1>, B0>, B0>
Signature: compressed response isogeny encoding (292 bytes).
Source§type ExpandedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B1>, B0>, B0>, B1>, B0>, B0>
type ExpandedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B1>, B0>, B0>, B1>, B0>, B0>
Expanded signature (420 bytes).
Source§type CompressedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B1>
type CompressedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B1>
Compressed signature (257 bytes).
Source§type SkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B0>, B0>, B0>, B0>, B0>, B0>
type SkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B0>, B0>, B0>, B0>, B0>, B0>
Secret key: ideal norm + generator coords + basis-change matrix. Actual content is 572 bytes; U576 is the next upstream hybrid-array size. The 4 trailing bytes are zero-padded.
Source§fn prime_le_bytes() -> &'static [u8]
fn prime_le_bytes() -> &'static [u8]
p as a static byte slice (little-endian canonical
encoding, length FP_ENCODED_BYTES).