in reply to Re: Code hanging with Crypt OpenPGP
in thread Code hanging with Crypt OpenPGP
sub gen_k { my ($p) = @_; ## XXX choose bitsize based on bitsize of $p my $bits = 198; my $p_minus1 = Math::BigInt->new($p)->bsub(1); my $k = Crypt::OpenPGP::Util::get_random_bigint($bits); while (1) { last if Math::BigInt::bgcd($k, $p_minus1) == 1; $k++; } $k; }
|
|---|