Sha256: 57faa41f4b36fd98d24235f28abeb265958e813d57bcf75b3228330acf2e7aa3
Contents?: true
Size: 329 Bytes
Versions: 103
Compression:
Stored size: 329 Bytes
Contents
extern crate rand; use rand::distributions::{IndependentSample, Range}; pub fn private_key(p: u64) -> u64 { Range::new(2, p).ind_sample(&mut rand::thread_rng()) } pub fn public_key(p: u64, g: u64, a: u64) -> u64 { g.pow(a as u32) % p } pub fn secret(p: u64, b_pub: u64, a: u64) -> u64 { b_pub.pow(a as u32) % p }
Version data entries
103 entries across 103 versions & 1 rubygems