るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
14件ヒット [1-14件を表示] (0.033秒)
トップページ > クエリ:self[x] > バージョン:2.4.0[x] > クラス:OpenSSL::BN[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

キーワード

検索結果

OpenSSL::BN#clear_bit!(n) -> self (307.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#copy(other) -> self (307.0)

other の内容を自身にコピーします。

...other の内容を自身にコピーします。

@param other コピーする OpenSSL::BN のオブジェクト
@raise OpenSSL::BNError コピーに失敗...

OpenSSL::BN#lshift!(n) -> self (307.0)

自身を n ビット左シフトします。 OpenSSL::BN#<<と異なり、破壊的メソッドです。

...す。
OpenSSL::BN
#<<と異なり、破壊的メソッドです。

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

bn = 1.to_bn
bn.lshift!(2) # => #<OpenSSL::BN 4>
bn # => #<OpenSSL::BN 4>
//}

@param n シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#<<...

OpenSSL::BN#mask_bits!(n) -> self (307.0)

自身を下位 n ビットでマスクし、破壊的に変更します。

...い場合は例外 OpenSSL::BNError
が発生します。

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

bn = 0b1111_1111.to_bn

bn.mask_bits!(8)
p "%b" % bn # => "11111111"

bn.mask_bits!(3)
p "%b" % bn # => "111"
//}

@param n マスクするビット数
@raise OpenSSL::BNError 計算時エ...

OpenSSL::BN#rshift!(n) -> self (307.0)

自身を n ビット右シフトします。 [[m:OpenSSL::BN#>>]と異なり、破壊的メソッドです。

...[[m:OpenSSL::BN#>>]と異なり、破壊的メソッドです。

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

bn = 8.to_bn
bn.rshift!(1) # => #<OpenSSL::BN 4>
bn # => #<OpenSSL::BN 4>
//}

@param n シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#>>...

絞り込み条件を変える

OpenSSL::BN#set_bit!(n) -> self (307.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?...

OpenSSL::BN#to_bn -> self (307.0)

自分自身を返します。

自分自身を返します。

OpenSSL::BN#coerce(other) -> Array (52.0)

自身と other が同じクラスになるよう、自身か other を変換し [other, self] という配列にして返します。

自身と other が同じクラスになるよう、自身か other を変換し
[other, self] という配列にして返します。

基本的に other が整数のときに、自身を Integer のオブジェクトに
変換して [other, 変換後オブジェクト] にして返します。
それ以外の場合は例外 TypeError を発生させます。

//emlist[][ruby]{
require 'openssl'
p 1.to_bn.coerce(2) # => [2, 1]
//}

@param other 変換の基準となるオブジェクト
@raise TypeError 変換に失敗した場合に発...

OpenSSL::BN#mod_add(other, m) -> OpenSSL::BN (52.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 (52.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 (52.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_sqr(m) -> OpenSSL::BN (52.0)

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

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

@param m mod を取る数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#sqr...

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