Ruby 2.2.0 リファレンスマニュアル > ライブラリ一覧 > opensslライブラリ > OpenSSL::BNクラス > mod_exp

instance method OpenSSL::BN#mod_exp

mod_exp(other, m) -> OpenSSL::BN[permalink][rdoc]

(self ** other) % m を返します。


require 'openssl'

OpenSSL::BN.new("7").mod_exp(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 1
[PARAM] other:
指数
[PARAM] m:
剰余を取る数
[EXCEPTION] OpenSSL::BNError:
計算時エラー