Trait curv::arithmetic::traits::EGCD

source ·
pub trait EGCDwhere
    Self: Sized,
{ fn egcd(a: &Self, b: &Self) -> (Self, Self, Self); }
Expand description

Extended GCD algorithm

Required Methods§

For given a, b calculates gcd(a,b), p, q such as gcd(a,b) = a*p + b*q

Example
let (a, b) = (BigInt::from(10), BigInt::from(15));
let (s, p, q) = BigInt::egcd(&a, &b);
assert_eq!(&s, &BigInt::from(5));
assert_eq!(s, a*p + b*q);

Implementors§