use super::falcon512_common::{
self, FalconVariant, MODULUS, N, PREVERSIONED_NONCE_LEN, Polynomial,
};
#[cfg(test)]
use super::falcon512_common::{
FalconFelt, LOG_N, SIG_NONCE_LEN, SIG_POLY_BYTE_LEN, SIG_SERIALIZED_LEN,
};
use crate::{Felt, Word};
mod hash_to_point;
#[cfg(test)]
mod tests;
pub type Nonce = falcon512_common::Nonce<variant::Variant>;
pub type PublicKey = falcon512_common::PublicKey<variant::Variant>;
pub type SecretKey = falcon512_common::SecretKey<variant::Variant>;
pub(super) mod variant {
use super::{FalconVariant, Felt, Nonce, Polynomial, Word, hash_to_point};
use crate::{
dsa::falcon512_common::FalconFelt,
hash::eidos::{Eidos, domains::FALCON_PUBLIC_KEY},
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Variant;
impl FalconVariant for Variant {
const NONCE_VERSION_BYTE: u8 = super::NONCE_VERSION_BYTE;
const PREVERSIONED_NONCE: [u8; super::PREVERSIONED_NONCE_LEN] = super::PREVERSIONED_NONCE;
fn hash_message_to_point(message: Word, nonce: &Nonce) -> Polynomial<FalconFelt> {
hash_to_point::hash_to_point_eidos(message, nonce)
}
fn public_key_commitment(elements: &[Felt]) -> Word {
Eidos::hash_elements_in_domain(elements, FALCON_PUBLIC_KEY)
}
}
}
const NONCE_VERSION_BYTE: u8 = 2;
const PREVERSIONED_NONCE: [u8; PREVERSIONED_NONCE_LEN] = [
9, 70, 65, 76, 67, 79, 78, 45, 69, 73, 68, 79, 83, 45, 68, 69, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
];