Skip to content

Commit

Permalink
solve diffie-hellman
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Jan 4, 2025
1 parent 903198b commit a5fccb2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion rust/diffie-hellman/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ pub fn public_key(p: u64, g: u64, a: u64) -> u64 {
}

pub fn secret(p: u64, b_pub: u64, a: u64) -> u64 {
return b_pub.pow(a.try_into().unwrap()) % p
b_pub.to_biguint().unwrap().modpow(&a.to_biguint().unwrap(), &p.to_biguint().unwrap()).try_into().unwrap()
}
1 change: 0 additions & 1 deletion rust/diffie-hellman/tests/diffie-hellman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ fn public_key_correct_big_numbers() {
}

#[test]
#[ignore]
fn secret_key_correct_big_numbers() {
let p: u64 = 4_294_967_927;

Expand Down

0 comments on commit a5fccb2

Please sign in to comment.