るりまサーチ (Ruby 2.5.0)

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. fileutils cp_r

ライブラリ

クラス

キーワード

検索結果

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

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

Integer を同じ数を表す 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::new(self)
end
end
//}

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

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

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

自身の 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 計算時エラー

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

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

自身を n ビット右シフトします。
[[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#pretty_print(pp) (27340.0)

Kernel.#pp でオブジェクトの内容を出力するときに、内部で呼ばれるメソッドです。

Kernel.#pp でオブジェクトの内容を出力するときに、内部で呼ばれるメソッドです。

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

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

@param pp PP クラスのインスタンスオブジェクト

OpenSSL::BN#coerce(other) -> Array (27322.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#<<(other) -> OpenSSL::BN (9622.0)

自身を other ビット左シフトした値を返します。

自身を other ビット左シフトした値を返します。

//emlist[][ruby]{
bn = 1.to_bn
pp bn << 1 # => #<OpenSSL::BN 2>
pp bn # => #<OpenSSL::BN 1>
//}

@param other シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#lshift!

OpenSSL::BN#>>(other) -> OpenSSL::BN (9622.0)

自身を other ビット右シフトした値を返します。

自身を other ビット右シフトした値を返します。

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

bn = 2.to_bn
bn >> 1 # => #<OpenSSL::BN 1>
bn # => #<OpenSSL::BN 2>
//}

@param other シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#rshift!

OpenSSL::BN#to_s(base=10) -> String (9556.0)

自身を表す文字列を返します。

自身を表す文字列を返します。

base で、変換方法(基数)を指定します。
デフォルトは 10 で、他に 16, 2, 0 を指定できます。

10 10進数の表記
16 16進数の表記
2 big-endianの符号無し整数のバイナリ列
0 MPI形式の文字列(バイト列)

@param base 文字列への変換方法(基数)
@raise OpenSSL::BNError 変換に失敗した場合に発生します

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

p 10.to_bn.to_s # => "10"
p (-5).to_bn....

OpenSSL::BN#num_bytes -> Integer (9394.0)

自身を表現するのに使っているバイト数を返します。

自身を表現するのに使っているバイト数を返します。

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

p 0.to_bn.num_bytes # => 0
p 255.to_bn.num_bytes # => 1
p 256.to_bn.num_bytes # => 2

p 0b111_11111.to_bn.num_bytes # => 1
p 0b1000_00000.to_bn.num_bytes # => 2
//}