export more, benchmarks

This commit is contained in:
Neemek 2025-10-09 21:28:56 +02:00
parent 2c7a005d7c
commit 321635a80a
4 changed files with 71 additions and 3 deletions

View file

@ -1,4 +1,4 @@
use crypto_bigint::{ConstChoice, Encoding, NonZero, U256};
pub use crypto_bigint::{ConstChoice, Encoding, NonZero, U256};
use std::fmt::{Display, Formatter};
use std::ops::{Div, Mul};
@ -31,7 +31,7 @@ impl MontgomeryCurve {
}
}
fn clamp_u256(x: U256) -> U256 {
pub fn clamp_u256(x: U256) -> U256 {
let mut bytes: [u8; 32] = x.to_le_bytes();
// clamp value
@ -262,7 +262,7 @@ impl Secret {
pub fn diffie_hellman(&self, public: &Public) -> Secret {
let point = CURVE_25519.point(public.0);
let p = point * self.0;
Secret(p.get_x())
}