pub mod curve;
pub mod engine;
pub mod field;
pub mod field_halo2curves;
pub mod pairing;
pub(crate) fn hex_to_bytes(hex: &str) -> Vec<u8> {
hex::decode(hex).expect("Invalid hex string")
}
#[cfg(any(test, feature = "dev-curves"))]
pub(crate) fn hex_to_field<F: ff::PrimeField>(hex: &str) -> F {
let mut bytes = hex_to_bytes(hex);
bytes.reverse();
let mut repr = F::Repr::default();
repr.as_mut()[..bytes.len()].copy_from_slice(&bytes);
F::from_repr(repr).unwrap()
}
#[cfg(any(test, feature = "dev-curves"))]
pub(crate) fn point_from_hex<C>(x_hex: &str, y_hex: &str) -> C
where
C: crate::CurveAffine,
C::Base: ff::PrimeField,
{
let x = hex_to_field(x_hex);
let y = hex_to_field(y_hex);
C::from_xy(x, y).expect("Invalid point coordinates")
}