Constants


No documentation available
No documentation available
No documentation available

Class Methods


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

Construct a new OpenSSL BIGNUM object.

If bn is an Integer or OpenSSL::BN, a new instance of OpenSSL::BN representing the same value is returned. See also Integer#to_bn for the short-hand.

If a String is given, the content will be parsed according to base.

string

The string to be parsed.

base

The format. Must be one of the following:

  • 0 - MPI format. See the man page BN_mpi2bn(3) for details.

  • 2 - Variable-length and big-endian binary encoding of a positive number.

  • 10 - Decimal number representation, with a leading '-' for a negative number.

  • 16 - Hexadeciaml number representation, with a leading '-' for a negative number.

Instance Methods


No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available

Division of OpenSSL::BN instances

No documentation available
An alias for cmp

Returns true only if obj has the same value as bn. Contrast this with OpenSSL::BN#eql?, which requires obj to be OpenSSL::BN.

An alias for ==
No documentation available
No documentation available

Tests bit bit in bn and returns true if set, false if not set.

No documentation available
No documentation available
No documentation available
An alias for initialize_copy

Returns true only if obj is a OpenSSL::BN with the same value as bn. Contrast this with OpenSSL::BN#==, which performs type conversions.

No documentation available

Returns the flags on the BN object. The argument is used as a bit mask.

Parameters

  • flags - integer

Returns a hash code for this object.

See also Object#hash.

No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available
No documentation available

Performs a Miller-Rabin probabilistic primality test with checks iterations. If checks is not specified, a number of iterations is used that yields a false positive rate of at most 2^-80 for random input.

Parameters

  • checks - integer

Performs a Miller-Rabin primality test. This is same as prime? except this first attempts trial divisions with some small primes.

Parameters

  • checks - integer

  • trial_div - boolean

No documentation available
No documentation available

Enables the flags on the BN object. Currently, the flags argument can contain zero of OpenSSL::BN::CONSTTIME.

No documentation available
No documentation available
No documentation available
An alias for to_i

Returns the string representation of the bignum.

BN.new can parse the encoded string to convert back into an OpenSSL::BN.

base

The format. Must be one of the following:

  • 0 - MPI format. See the man page BN_bn2mpi(3) for details.

  • 2 - Variable-length and big-endian binary encoding. The sign of the bignum is ignored.

  • 10 - Decimal number representation, with a leading '-' for a negative bignum.

  • 16 - Hexadeciaml number representation, with a leading '-' for a negative bignum.

No documentation available
No documentation available