MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / generate_keys

Function generate_keys

tests/binary/rsa/src/main.rs:50–62  ·  view source on GitHub ↗

RSA key generation (with hardcoded small primes for simplicity)

()

Source from the content-addressed store, hash-verified

48
49// RSA key generation (with hardcoded small primes for simplicity)
50fn generate_keys() -> (PublicKey, PrivateKey) {
51 let p = 61;
52 let q = 53;
53 let n = p * q;
54 let phi = (p - 1) * (q - 1);
55 let e = 17;
56 let d = mod_inv(e as i64, phi as i64) as u64;
57
58 (
59 PublicKey { e, n },
60 PrivateKey { d, n },
61 )
62}
63
64// RSA encryption: c = m^e mod n
65fn encrypt(pub_key: &PublicKey, message: u64) -> u64 {

Callers 1

mainFunction · 0.85

Calls 1

mod_invFunction · 0.85

Tested by

no test coverage detected