pub struct LaiCryptoEngine {
pub p: u128,
pub a: u128,
pub p0: (u128, u128),
pub trace: Vec<TraceStep>,
pub metrics: PerfMetrics,
pub max_attempts: u32,
pub max_duration: Duration,
}Expand description
LAI cryptographic engine with enhanced capabilities
Fields§
§p: u128§a: u128§p0: (u128, u128)§trace: Vec<TraceStep>§metrics: PerfMetrics§max_attempts: u32§max_duration: DurationImplementations§
Source§impl LaiCryptoEngine
impl LaiCryptoEngine
Sourcepub fn new(p: u128, a: u128, p0: (u128, u128)) -> Result<Self, LaiCryptoError>
pub fn new(p: u128, a: u128, p0: (u128, u128)) -> Result<Self, LaiCryptoError>
Create new engine with parameter validation
Sourcepub fn sqrt_mod(&mut self, a: u128) -> Option<u128>
pub fn sqrt_mod(&mut self, a: u128) -> Option<u128>
Modular square root with detailed error handling
Sourcepub fn t(
&mut self,
point: (u128, u128),
s: u128,
) -> Result<(u128, u128), LaiCryptoError>
pub fn t( &mut self, point: (u128, u128), s: u128, ) -> Result<(u128, u128), LaiCryptoError>
Single T-transform with detailed tracing
Sourcepub fn pow_t_range(
&mut self,
point: (u128, u128),
start_s: u128,
exp: u128,
) -> Result<(u128, u128), LaiCryptoError>
pub fn pow_t_range( &mut self, point: (u128, u128), start_s: u128, exp: u128, ) -> Result<(u128, u128), LaiCryptoError>
Apply T-transform multiple times
Sourcepub fn keygen(&mut self) -> Result<(u128, (u128, u128)), LaiCryptoError>
pub fn keygen(&mut self) -> Result<(u128, (u128, u128)), LaiCryptoError>
Key generation with validation
Sourcepub fn encrypt(
&mut self,
m: u128,
q: (u128, u128),
) -> Result<((u128, u128), (u128, u128), u128), LaiCryptoError>
pub fn encrypt( &mut self, m: u128, q: (u128, u128), ) -> Result<((u128, u128), (u128, u128), u128), LaiCryptoError>
Encryption with integrity checks
Sourcepub fn decrypt(
&mut self,
c1: (u128, u128),
c2: (u128, u128),
k: u128,
) -> Result<u128, LaiCryptoError>
pub fn decrypt( &mut self, c1: (u128, u128), c2: (u128, u128), k: u128, ) -> Result<u128, LaiCryptoError>
Decryption with validation
Sourcepub fn generate_perf_graph(&self, style: GraphStyle) -> CryptoGraph
pub fn generate_perf_graph(&self, style: GraphStyle) -> CryptoGraph
Generate performance graphs
Sourcepub fn generate_complexity_graph(&self) -> CryptoGraph
pub fn generate_complexity_graph(&self) -> CryptoGraph
Generate complexity graph
Sourcepub fn print_trace(&self)
pub fn print_trace(&self)
Print detailed trace with diagnostics
Auto Trait Implementations§
impl Freeze for LaiCryptoEngine
impl RefUnwindSafe for LaiCryptoEngine
impl Send for LaiCryptoEngine
impl Sync for LaiCryptoEngine
impl Unpin for LaiCryptoEngine
impl UnwindSafe for LaiCryptoEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more