Browse Source

made encryption arguments pointers

pull/8/head
Nanak Nihal Singh Khalsa 1 year ago
parent
commit
3b7e9c6acf
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/lib.rs

+ 3
- 3
src/lib.rs

@ -430,7 +430,7 @@ impl PrivateKey {
}
// encrypts msg to public key to_pubkey, using some random scalar nonce
pub fn encrypt_elgamal(to_pubkey: Point, nonce: BigInt, msg: &Point) -> ElGamalEncryption {
pub fn encrypt_elgamal(to_pubkey: &Point, nonce: &BigInt, msg: &Point) -> ElGamalEncryption {
let shared_secret = to_pubkey.mul_scalar(&nonce);
println!("Shared Secret 2 {:?}", shared_secret);
let public_nonce = B8.mul_scalar(&nonce);
@ -529,8 +529,8 @@ mod tests {
let some_point = B8.mul_scalar(&BigInt::from_u8(0x69).unwrap());
let some_privkey = new_key();
let some_point_encrypted = encrypt_elgamal(
some_privkey.public(),
BigInt::parse_bytes(b"ABCDEF123456789", 16).unwrap(),
&some_privkey.public(),
&BigInt::parse_bytes(b"ABCDEF123456789", 16).unwrap(),
&some_point
);
let some_point_encrypted_decrypted = some_privkey.decrypt_elgamal(some_point_encrypted);

Loading…
Cancel
Save