Skip to main content

miden_precompiles/math/
k1_base.rs

1//! secp256k1 base-field domain for the uint precompile.
2
3use miden_core::Felt;
4
5use crate::math::uint::{Limbs, UintSpec};
6
7/// Marker type for the secp256k1 base field.
8#[derive(Debug, Default, Clone, Copy)]
9pub struct K1Base;
10
11impl K1Base {
12    /// Stable local domain selector carried in uint precompile tags.
13    pub const ID: Felt = Felt::new_unchecked(1);
14
15    /// Modulus of the secp256k1 base field, little-endian u32 limbs.
16    pub const MODULUS: Limbs = [
17        0xffff_fc2f,
18        0xffff_fffe,
19        0xffff_ffff,
20        0xffff_ffff,
21        0xffff_ffff,
22        0xffff_ffff,
23        0xffff_ffff,
24        0xffff_ffff,
25    ];
26}
27
28impl UintSpec for K1Base {
29    const ID: Felt = Self::ID;
30    const ENCODED_MODULUS: Limbs = Self::MODULUS;
31    const IS_PRIME_FIELD: bool = true;
32}