Skip to content

Commit

Permalink
feat: pow
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWOLAND committed Nov 29, 2023
1 parent 255525c commit 5283c9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ impl BigInt {
*self.v.params()
}

pub fn pow(&self, n: u128) -> BigInt {
BigInt {
v: self.v.pow(&Uint::<4>::from_u128(n)),
}
}

pub fn mod_exp(&self, exp: BigInt, M: BigInt) -> BigInt {
let mut res: BigInt = if !exp.is_even() {
self.clone()
Expand Down

0 comments on commit 5283c9e

Please sign in to comment.