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(*args)
constructor
new
=> aBN. -
.pseudo_rand
BN
.pseudo_rand(bits [, fill [, odd]]) -> aBN. -
.pseudo_rand_range
BN
.pseudo_rand_range(range) -> aBN. -
.rand
BN
.rand(bits [, fill [, odd]]) -> aBN. -
.rand_range
BN
.rand_range(range) -> aBN.
Instance Attribute Summary
-
#odd? ⇒ Boolean
readonly
bn.odd? => true | false.
-
#one? ⇒ Boolean
readonly
bn.one? => true | false.
-
#zero? ⇒ Boolean
readonly
bn.zero? => true | false.
Instance Method Summary
-
#%
bn % bn2 => aBN.
-
#*
bn * bn2 => aBN.
-
#**
bn ** bn2 => aBN.
-
#+
bn + bn2 => aBN.
-
#-
bn - bn2 => aBN.
-
#/
bn1 / bn2 => [result, remainder].
- #<<(bits) ⇒ BN
-
#<=>
(also: #cmp)
bn.cmp(bn2) => integer.
-
#==(obj) ⇒ Boolean
(also: #===)
Returns
true
only ifobj
has the same value asbn
. -
#===(obj) ⇒ Boolean
Alias for #==.
- #>>(bits) ⇒ BN
-
#bit_set? ⇒ Boolean
Returns boolean of whether
bit
is set. -
#clear_bit!
bn.clear_bit!(bit) -> self.
-
#cmp
Alias for #<=>.
- #coerce(other)
-
#copy(other)
bn.num_bits => integer.
-
#eql?(obj) ⇒ Boolean
Returns
true
only if obj is aBN
with the same value as big. -
#gcd
bn.gcd(bn2) => aBN.
-
#hash ⇒ Integer
Returns a hash code for this object.
-
#lshift!
bn.lshift!(bits) -> self.
- #mask_bits!
-
#mod_add
bn.mod_add(bn1, bn2) -> aBN.
-
#mod_exp
bn.mod_exp(bn1, bn2) -> aBN.
-
#mod_inverse
bn.mod_inverse(bn2) => aBN.
-
#mod_mul
bn.mod_mul(bn1, bn2) -> aBN.
-
#mod_sqr
bn.mod_sqr(bn2) => aBN.
-
#mod_sub
bn.mod_sub(bn1, bn2) -> aBN.
-
#num_bits
bn.num_bits => integer.
-
#num_bytes
bn.num_bytes => integer.
- #pretty_print(q)
-
#prime? ⇒ Boolean
Parameters *
checks
- integer. -
#prime_fasttest? ⇒ Boolean
Parameters *
checks
- integer *trial_div
- boolean. -
#rshift!
bn.rshift!(bits) -> self.
-
#set_bit!
bn.set_bit!(bit) -> self.
-
#sqr
bn.sqr => aBN.
- #to_bn
- #to_i ⇒ Integer (also: #to_int)
-
#to_int ⇒ Integer
Alias for #to_i.
-
#to_s ⇒ String
Parameters *
base
- integer * * Valid values: * * * 0 - MPI * * * 2 - binary * * * 10 - the default * * * 16 - hex. -
#ucmp
bn.ucmp(bn2) => integer.
Constructor Details
.new(*args)
Class Method Details
.generate_prime
.pseudo_rand
BN
.pseudo_rand(bits [, fill [, odd]]) -> aBN
.pseudo_rand_range
BN
.pseudo_rand_range(range) -> aBN
.rand
BN
.rand(bits [, fill [, odd]]) -> aBN
.rand_range
BN
.rand_range(range) -> aBN
Instance Attribute Details
#odd? ⇒ Boolean
(readonly)
bn.odd? => true | false
#one? ⇒ Boolean
(readonly)
bn.one? => true | false
#zero? ⇒ Boolean
(readonly)
bn.zero? => true | false
Instance Method Details
#%
bn % bn2 => aBN
#*
bn * bn2 => aBN
#**
bn ** bn2 => aBN
#+
bn + bn2 => aBN
#-
bn - bn2 => aBN
#/
bn1 / bn2 => [result, remainder]
Division of BN
instances
#<<(bits) ⇒ BN
#<=> Also known as: #cmp
bn.cmp(bn2) => integer
#==(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? ⇒ Boolean
Returns boolean of whether bit
is set. Bitwise operations for openssl BIGNUMs.
bn.bit_set?(bit) => true | false
#clear_bit!
bn.clear_bit!(bit) -> self
#cmp
Alias for #<=>.
#coerce(other)
#copy(other)
bn.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
bn.gcd(bn2) => aBN
#hash ⇒ Integer
Returns a hash code for this object.
See also Object#hash
.
#lshift!
bn.lshift!(bits) -> self
#mask_bits!
#mod_add
bn.mod_add(bn1, bn2) -> aBN
#mod_exp
bn.mod_exp(bn1, bn2) -> aBN
#mod_inverse
bn.mod_inverse(bn2) => aBN
#mod_mul
bn.mod_mul(bn1, bn2) -> aBN
#mod_sqr
bn.mod_sqr(bn2) => aBN
#mod_sub
bn.mod_sub(bn1, bn2) -> aBN
#num_bits
bn.num_bits => integer
#num_bytes
bn.num_bytes => integer
#pretty_print(q)
[ GitHub ]
#prime? ⇒ Boolean
#prime?(checks) ⇒ Boolean
Boolean
#prime?(checks) ⇒ Boolean
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
Parameters
-
checks
- integer -
trial_div
- boolean
#rshift!
bn.rshift!(bits) -> self
#set_bit!
bn.set_bit!(bit) -> self
#sqr
bn.sqr => aBN
#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
-
#ucmp
bn.ucmp(bn2) => integer