Update RSA key generation to use full key size for prime generation
This commit is contained in:
parent
36d25f2dd5
commit
411e1e0461
1 changed files with 2 additions and 2 deletions
|
@ -15,8 +15,8 @@ pub struct RSA {
|
||||||
impl RSA {
|
impl RSA {
|
||||||
pub fn new(key_size: usize) -> Self {
|
pub fn new(key_size: usize) -> Self {
|
||||||
// Generate two random primes of key_size/2 bits each
|
// Generate two random primes of key_size/2 bits each
|
||||||
let p = Generator::new_prime(key_size / 2);
|
let p = Generator::new_prime(key_size);
|
||||||
let q = Generator::new_prime(key_size / 2);
|
let q = Generator::new_prime(key_size);
|
||||||
|
|
||||||
// Convert num-primes::BigUint to num-bigint::BigUint
|
// Convert num-primes::BigUint to num-bigint::BigUint
|
||||||
let p_bigint = num_bigint::BigUint::parse_bytes(p.to_string().as_bytes(), 10).unwrap();
|
let p_bigint = num_bigint::BigUint::parse_bytes(p.to_string().as_bytes(), 10).unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue