るりまサーチ

最速Rubyリファレンスマニュアル検索!
144件ヒット [101-144件を表示] (0.039秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

キーワード

検索結果

<< < 1 2 >>

OpenSSL::BN#mod_mul(other, m) -> OpenSSL::BN (43.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 (43.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 計算時エラー...

Integer#to_bn -> OpenSSL::BN (27.0)

Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。

...同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'pp'
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
class Integer...
...def to_bn
OpenSSL::BN::new(self)
end
end
//}

@
see OpenSSL::BN.new, OpenSSL::BN#to_i...
... OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
class Integer
def to_bn
OpenSSL
::BN::n...
...ew(self)
end
end
//}

@
see OpenSSL::BN.new, OpenSSL::BN#to_i...

OpenSSL::BN#mod_inverse(m) -> OpenSSL::BN (27.0)

自身の mod m における逆元を返します。

...します。

(self * r) % m == 1 となる r を返します。
存在しない場合は例外 OpenSSL::BNError が発生します。

//emlist[][ruby]{
require 'openssl'

p 3.to_bn.mod_inverse(5) # => 2
p (3 * 2) % 5 # => 1
//}

@
param m mod を取る数
@
raise OpenSSL::BNError 計算...
<< < 1 2 >>