MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / generate_keypair

Function generate_keypair

src/ciphers/rsa_cipher.rs:148–168  ·  view source on GitHub ↗

Generates an RSA keypair from two prime numbers # Arguments `p` - First prime number `q` - Second prime number (should be different from p) # Returns A tuple containing (PublicKey, PrivateKey) # Examples ``` use the_algorithms_rust::ciphers::generate_keypair; let (public, private) = generate_keypair(61, 53); // n = p * q assert_eq!(public.n, 3233); assert_eq!(private.n, 3233); // Both keys

(p: u64, q: u64)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Calls 2

gcdFunction · 0.70
mod_inverseFunction · 0.70