fn log_p(base: u64, value: u64) -> Option<u64> {
    let mut v = 1;
    for exp in 0..P {
        if v == value { return Some(exp); }
        v = (v * base) % P;
    }
    None
}
// Compute the logarithm of an element in Z_P by brute force search.
Compute the logarithm of an element in Z_P by brute force search.
Compute the logarithm of an element in Z_P by brute force search .
fn log_p(base: u64, value: u64) -> Option<u64> {
    let mut v = 1;
    for exp in 0..P {
        if v == value { return Some(exp); }
        v = (v * base) % P;
    }
    None
}
fn log_p ( base : u64 , value : u64 ) -> Option < u64 > { let mut v = 1 ; for exp in 0 .. P { if v == value { return Some ( exp ) ; } v = ( v * base ) % P ; } None }
Compute the logarithm of an element in Z_P by brute force search.
Compute the logarithm of an element in Z_P by brute force search .
base
u64
value
u64