don't use safe primes for private keys

This commit is contained in:
mehbark 2026-04-23 01:30:46 -04:00
parent ede1a43e4a
commit bf265490a8
Signed by: mbk
GPG key ID: E333EC1335FFCCDB
2 changed files with 2 additions and 2 deletions

View file

@ -1,5 +1,5 @@
# toy Diffie-Hellman key exchange # toy Diffie-Hellman key exchange
Uses 256-bit Sophie-Germain primes for stuff Uses 256-bit primes for stuff
``` ```
nix run git+https://git.pyrope.net/mbk/diffie-hellman nix run git+https://git.pyrope.net/mbk/diffie-hellman

View file

@ -23,7 +23,7 @@ fn main() {
println!("p = {p}, g = {g}"); println!("p = {p}, g = {g}");
let a: BigUint = rng.gen_safe_prime(256); let a: BigUint = rng.gen_prime(256, None);
println!("a = {a}"); println!("a = {a}");
let ga = g.modpow(&a, &p); let ga = g.modpow(&a, &p);