13件ヒット
[1-13件を表示]
(0.327秒)
別のキーワード
検索結果
先頭5件
-
OpenSSL
:: BN # mod _ add(other , m) -> OpenSSL :: BN (63424.0) -
(self + other) % m を返します。
...(self + other) % m を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("7").mod_add(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 4
//}
@param other 和を取る数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー... -
OpenSSL
:: BN # mod _ exp(other , m) -> OpenSSL :: BN (63424.0) -
(self ** other) % m を返します。
...(self ** other) % m を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("7").mod_exp(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 1
//}
@param other 指数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー... -
OpenSSL
:: BN # mod _ mul(other , m) -> OpenSSL :: BN (63424.0) -
(self * other) % m を返します。
...(self * other) % m を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("7").mod_mul(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 3
//}
@param other 積を取る数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー... -
OpenSSL
:: BN # mod _ sub(other , m) -> OpenSSL :: BN (63424.0) -
(self - other) % m を返します。
...(self - other) % m を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("27").mod_sub(OpenSSL::BN.new("3"), OpenSSL::BN.new("5")) # => 4
//}
@param other 引く数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー... -
OpenSSL
:: BN # <=>(other) -> -1 | 0 | 1 (63283.0) -
自身と other を比較し、自身が小さいときには -1、 等しいときには 0、大きいときには 1 を返します。
...きには 1 を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new(5) <=> 5 # => 0
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(9) # => -1
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(5) # => 0
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(-5) # => 1
//}
@param other 比較する整数
@rais......e TypeError 比較できないときに発生します。
@see OpenSSL::BN#ucmp... -
OpenSSL
:: BN # cmp(other) -> -1 | 0 | 1 (63283.0) -
自身と other を比較し、自身が小さいときには -1、 等しいときには 0、大きいときには 1 を返します。
...きには 1 を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new(5) <=> 5 # => 0
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(9) # => -1
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(5) # => 0
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(-5) # => 1
//}
@param other 比較する整数
@rais......e TypeError 比較できないときに発生します。
@see OpenSSL::BN#ucmp... -
OpenSSL
:: BN # ucmp(other) -> -1 | 0 | 1 (63283.0) -
自身と other の絶対値を比較し、自身の絶対値が小さいときには -1、 等しいときには 0、 大きいときには 1 を返します。
...は 1 を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new(-5).ucmp(5) # => 0
OpenSSL::BN.new(5).ucmp(OpenSSL::BN.new(-9)) # => -1
OpenSSL::BN.new(-5).ucmp(OpenSSL::BN.new(5)) # => 0
OpenSSL::BN.new(-5).ucmp(OpenSSL::BN.new(2)) # => 1
//}
@param other 比較する整数......@raise TypeError 比較できないときに発生します。
@see OpenSSL::BN#cmp... -
OpenSSL
:: BN # num _ bits -> Integer (63121.0) -
自身を表現するのに使っているビット数を返します。
...自身を表現するのに使っているビット数を返します。
符号は無視されます。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("127").num_bits # => 7
OpenSSL::BN.new("-127").num_bits # => 7
OpenSSL::BN.new("128").num_bits # => 8
//}... -
OpenSSL
:: BN # prime _ fasttest?(checks=nil , vtrivdiv=true) -> bool (63103.0) -
自身が素数であるなら true を返します。
...り返します。
checksがnilである場合は OpenSSL が適切な
回数を判断します。
//emlist[][ruby]{
require 'openssl'
# 181 は 「小さな素数」である
OpenSSL::BN.new("181").prime_fasttest?(nil, true) # => false
OpenSSL::BN.new("181").prime_fasttest?(nil, false) # => true......//}
@param checks Miller-Robin法の繰り返しの回数
@param vtrivdiv 真なら小さな素数で割ることでの素数判定を試みます
@raise OpenSSL::BNError 判定時にエラーが発生
@see OpenSSL::BN#prime?... -
OpenSSL
:: BN # to _ s(base=10) -> String (63103.0) -
自身を表す文字列を返します。
...列
0 MPI形式の文字列(バイト列)
@param base 文字列への変換方法(基数)
@raise OpenSSL::BNError 変換に失敗した場合に発生します
//emlist[][ruby]{
require 'openssl'
p 10.to_bn.to_s # => "10"
p (-5).to_bn.to_s # => "-5"
p 0.to_bn.to_s(16) # => "0"
p 9.to_......o_s(2) # => "\a"
p 0.to_bn.to_s(0) # => "\x00\x00\x00\x00"
p 6.to_bn.to_s(0) # => "\x00\x00\x00\x01\x06"
p 7.to_bn.to_s(0) # => "\x00\x00\x00\x01\a"
//}
反対に、文字列から OpenSSL::BN クラスのインスタンスを作るには
OpenSSL::BN.new を用います。
@see OpenSSL::BN.new... -
OpenSSL
:: BN # bit _ set?(n) -> bool (63085.0) -
自身の n ビット目が立っているなら true を返します。
...自身の n ビット目が立っているなら true を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("129").bit_set?(0) # => true
OpenSSL::BN.new("129").bit_set?(1) # => false
//}
@param n 調べるビットの位置
@see OpenSSL::set_bit!... -
OpenSSL
:: BN # clear _ bit!(n) -> self (63049.0) -
自身の n ビット目を0にします。
...自身の n ビット目を0にします。
//emlist[][ruby]{
require 'openssl'
a = OpenSSL::BN.new("129")
a.clear_bit!(0)
a # => 128
//}
@param n 0にするビットの位置
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::set_bit!... -
OpenSSL
:: BN # set _ bit!(n) -> self (63049.0) -
自身の n ビット目を1にします。
...自身の n ビット目を1にします。
//emlist[][ruby]{
require 'openssl'
a = OpenSSL::BN.new("128")
a.set_bit!(0)
a # => 129
//}
@param n 1にするビットの位置
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::clear_bit!, OpenSSL::bit_set?...