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
- .generate_prime
- 
    
      .new  ⇒ BN 
    
    constructor
    Construct a new ::OpenSSL BigNum object. 
- 
    
      .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 Summary
- #odd? ⇒ Boolean readonly
- #one? ⇒ Boolean readonly
- #zero? ⇒ Boolean readonly
Instance Method Summary
- #%(bn2) ⇒ BN
- #*(bn2) ⇒ BN
- #**(bn2) ⇒ BN
- #+(bn2) ⇒ BN
- #-(bn2) ⇒ BN
- 
    
      #/(bn2)  ⇒ Array, remainder 
    
    Division of BNinstances.
- #<<(bits) ⇒ BN
- #<=>(bn2) ⇒ Integer (also: #cmp)
- 
    
      #==(obj)  ⇒ Boolean 
      (also: #===)
    
    Returns trueonly ifobjhas the same value asbn.
- 
    
      #===(obj)  ⇒ Boolean 
    
    Alias for #==. 
- #>>(bits) ⇒ BN
- 
    
      #bit_set?(bit)  ⇒ Boolean 
    
    Returns boolean of whether bitis set.
- #clear_bit!(bit) ⇒ self
- 
    
      #cmp(bn2)  ⇒ Integer 
    
    Alias for #<=>. 
- #coerce(other)
- #num_bits ⇒ Integer
- 
    
      #eql?(obj)  ⇒ Boolean 
    
    Returns trueonly if obj is aBNwith the same value as big.
- #gcd(bn2) ⇒ BN
- 
    
      #hash  ⇒ Integer 
    
    Returns a hash code for this object. 
- #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_bits ⇒ Integer
- #num_bytes ⇒ Integer
- #pretty_print(q)
- 
    
      #prime?  ⇒ Boolean 
    
    Performs a Miller-Rabin probabilistic primality test with checksiterations.
- 
    
      #prime_fasttest?  ⇒ Boolean 
    
    Performs a Miller-Rabin primality test. 
- #rshift!(bits) ⇒ self
- #set_bit!(bit) ⇒ self
- #sqr ⇒ BN
- #to_bn
- #to_i ⇒ Integer (also: #to_int)
- 
    
      #to_int  ⇒ Integer 
    
    Alias for #to_i. 
- 
    
      #to_s  ⇒ String 
    
    Parameters * base- integer.
- #ucmp(bn2) ⇒ Integer
Constructor Details
    
      .new  ⇒ BN 
      .new(bn)  ⇒ BN 
      .new(integer)  ⇒ BN 
      .new(string)  ⇒ BN 
      .new(string, 0 | 2 | 10 | 16)  ⇒ BN 
    
  
BN 
      .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 
    
  
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   
Alias for #<=>.
#coerce(other)
#num_bits ⇒ Integer
    #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   
#hash ⇒ Integer
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_bits ⇒ Integer
#num_bytes ⇒ Integer
#pretty_print(q)
[ GitHub ]
    
      #prime?  ⇒ Boolean 
      #prime?(checks)  ⇒ Boolean 
    
  
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 
    
  
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   
    #sqr  ⇒ BN   
#to_bn
#to_i ⇒ Integer Also known as: #to_int
Alias for #to_i.
    
      #to_s  ⇒ String 
      #to_s(base)  ⇒ String 
    
  
String 
      #to_s(base)  ⇒ String 
    Parameters
- 
base- integer Valid values:- 
0 - MPI 
- 
2 - binary 
- 
10 - the default 
- 
16 - hex 
 
-