123456789_123456789_123456789_123456789_123456789_

Class: OpenSSL::BN

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, Comparable
Inherits: Object
Defined in: ext/openssl/ossl_bn.c,
ext/openssl/lib/openssl/bn.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newBN .new(bn) ⇒ BN .new(integer) ⇒ BN .new(string) ⇒ BN .new(string, 0 | 2 | 10 | 16) ⇒ BN

Construct a new ::OpenSSL BigNum object.

Class Method Details

.generate_prime

.pseudo_rand

BN.pseudo_rand(bits [, fill [, odd]]) -> aBN

.pseudo_rand_range(range) ⇒ BN

.rand

BN.rand(bits [, fill [, odd]]) -> aBN

.rand_range(range) ⇒ BN

Instance Attribute Details

#odd?Boolean (readonly)

#one?Boolean (readonly)

#zero?Boolean (readonly)

Instance Method Details

#%(bn2) ⇒ BN

#*(bn2) ⇒ BN

#**(bn2) ⇒ BN

#+(bn2) ⇒ BN

#-(bn2) ⇒ BN

#/(bn2) ⇒ Array, remainder

Division of BN instances

#<<(bits) ⇒ BN

#<=>(bn2) ⇒ Integer Also known as: #cmp

#==(obj) ⇒ Boolean Also known as: #===

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

#==(obj) ⇒ Boolean #===(obj) ⇒ Boolean

Alias for #==.

#>>(bits) ⇒ BN

#bit_set?(bit) ⇒ Boolean

Returns boolean of whether bit is set. Bitwise operations for openssl BIGNUMs.

#clear_bit!(bit) ⇒ self

#<=>(bn2) ⇒ Integer #cmp(bn2) ⇒ Integer

Alias for #<=>.

#coerce(other)

#num_bitsInteger

#eql?(obj) ⇒ Boolean

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

#gcd(bn2) ⇒ BN

#hashInteger

Returns a hash code for this object.

See also Object#hash.

#lshift!(bits) ⇒ self

#mask_bits!

#mod_add(bn1, bn2) ⇒ BN

#mod_exp(bn1, bn2) ⇒ BN

#mod_inverse(bn2) ⇒ BN

#mod_mul(bn1, bn2) ⇒ BN

#mod_sqr(bn2) ⇒ BN

#mod_sub(bn1, bn2) ⇒ BN

#num_bitsInteger

#num_bytesInteger

#pretty_print(q)

[ GitHub ]

  
# File 'ext/openssl/lib/openssl/bn.rb', line 20

def pretty_print(q)
  q.object_group(self) {
    q.text ' '
    q.text to_i.to_s
  }
end

#prime?Boolean #prime?(checks) ⇒ Boolean

Performs a Miller-Rabin probabilistic primality test with checks iterations. If nchecks 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

#prime_fasttest?Boolean #prime_fasttest?(checks) ⇒ Boolean #prime_fasttest?(checks, trial_div) ⇒ Boolean

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

#rshift!(bits) ⇒ self

#set_bit!(bit) ⇒ self

#sqrBN

#to_bn

#to_iInteger Also known as: #to_int

#to_iInteger #to_intInteger

Alias for #to_i.

#to_sString #to_s(base) ⇒ String

Parameters

  • base - integer Valid values:

    • 0 - MPI

    • 2 - binary

    • 10 - the default

    • 16 - hex

#ucmp(bn2) ⇒ Integer