Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

OpenSSL::BN.generate_prime

BN.generate_prime(bits, [, safe [, add [, rem]]]) => bn

Generates a random prime number of bit length bits. If safe is set to true, generates a safe prime. If add is specified, generates a prime that fulfills condition p % add = rem.

Parameters

  • bits - integer

  • safe - boolean

  • add - BN

  • rem - BN

See also .new .rand also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0