LaiCryptoEngine

Struct LaiCryptoEngine 

Source
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: Duration

Implementations§

Source§

impl LaiCryptoEngine

Source

pub fn new(p: u128, a: u128, p0: (u128, u128)) -> Result<Self, LaiCryptoError>

Create new engine with parameter validation

Source

pub fn mod_pow(&self, base: u128, exp: u128) -> u128

Modular exponentiation (optimized)

Source

pub fn sqrt_mod(&mut self, a: u128) -> Option<u128>

Modular square root with detailed error handling

Source

pub fn h(&self, x: u128, y: u128, s: u128) -> u128

Enhanced hash function for T-transform

Source

pub fn t( &mut self, point: (u128, u128), s: u128, ) -> Result<(u128, u128), LaiCryptoError>

Single T-transform with detailed tracing

Source

pub fn pow_t_range( &mut self, point: (u128, u128), start_s: u128, exp: u128, ) -> Result<(u128, u128), LaiCryptoError>

Apply T-transform multiple times

Source

pub fn keygen(&mut self) -> Result<(u128, (u128, u128)), LaiCryptoError>

Key generation with validation

Source

pub fn encrypt( &mut self, m: u128, q: (u128, u128), ) -> Result<((u128, u128), (u128, u128), u128), LaiCryptoError>

Encryption with integrity checks

Source

pub fn decrypt( &mut self, c1: (u128, u128), c2: (u128, u128), k: u128, ) -> Result<u128, LaiCryptoError>

Decryption with validation

Source

pub fn generate_perf_graph(&self, style: GraphStyle) -> CryptoGraph

Generate performance graphs

Source

pub fn generate_complexity_graph(&self) -> CryptoGraph

Generate complexity graph

Source

pub fn print_trace(&self)

Print detailed trace with diagnostics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V