pub struct Level3;Expand description
NIST Security Level III (192-bit post-quantum security).
Prime: p = 65 * 2^376 - 1, encoded in 48 bytes.
Trait Implementations§
Source§impl FpBackend for Level3
impl FpBackend for Level3
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 Level3
impl LevelPrecomp for Level3
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 Level3
impl SecurityLevel for Level3
Source§const HASH_ITERATIONS: u32 = 256
const HASH_ITERATIONS: u32 = 256
Up to 256 SHAKE256 squeeze attempts to find a valid challenge.
Source§const NWORDS_ORDER: usize = 6
const NWORDS_ORDER: usize = 6
6 limbs × 64 = 384-bit scalar width.
Source§const TORSION_EVEN_POWER: u32 = 376
const TORSION_EVEN_POWER: u32 = 376
v_2(p + 1) = 376.
Source§const P_COFACTOR_FOR_2F_BITLENGTH: usize = 7
const P_COFACTOR_FOR_2F_BITLENGTH: usize = 7
(p + 1) / 2^376 = 65, which is 7 bits.
Source§const SQISIGN_RESPONSE_LENGTH: u32 = 192
const SQISIGN_RESPONSE_LENGTH: u32 = 192
Response isogeny length = 192 bits (same as E_RSP).
Source§type FpLimbs = UInt<UInt<UInt<UTerm, B1>, B1>, B1>
type FpLimbs = UInt<UInt<UInt<UTerm, B1>, B1>, B1>
7 limbs × 55-bit radix = 385 bits of storage for the 383-bit prime.
Source§type MpLimbs = UInt<UInt<UInt<UTerm, B1>, B1>, B0>
type MpLimbs = UInt<UInt<UInt<UTerm, B1>, B1>, B0>
6 limbs × 64 bits = 384-bit scalars for order arithmetic.
Source§type FpEncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>
type FpEncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>
p fits in 48 bytes (383 bits).
Source§type Fp2EncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>, B0>
type Fp2EncodedBytes = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>, B0>
Two Fp elements = 96 bytes.
Source§type PkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>, B1>
type PkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B0>, B1>
Public key: 1-byte header + 2 × 48 bytes for the Fp2 j-invariant.
Source§type SigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B0>, B0>, B0>, B0>, B0>
type SigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B0>, B0>, B0>, B0>, B0>
Signature: compressed response isogeny encoding (224 bytes).
Source§type ExpandedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B1>, B1>, B1>, B0>, B0>
type ExpandedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>, B1>, B1>, B1>, B0>, B0>
Expanded signature (316 bytes).
Source§type CompressedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B1>, B0>, B0>
type CompressedSigLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B1>, B0>, B0>
Compressed signature (196 bytes).
Source§type SkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B1>, B1>, B0>, B0>, B0>, B0>
type SkLen = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B1>, B1>, B0>, B0>, B0>, B0>
Secret key: ideal norm + generator coords + basis-change matrix (432 bytes).
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).