るりまサーチ

最速Rubyリファレンスマニュアル検索!
120件ヒット [1-100件を表示] (0.084秒)
トップページ > クエリ:c[x] > クエリ:to_bn[x]

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

OpenSSL::PKey::EC::Point#to_bn -> OpenSSL::BN (21101.0)

点を整数に変換します。

...点を整数に変換します。

@raise OpenSSL::PKey::EC::Point::Error 変換に失敗した場合に発生します...

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

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

...

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

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

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

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

@see OpenSSL::BN.ne...
...換します。

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

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

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

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

@see OpenSSL::BN.new...

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

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

...

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

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

c
oerce メソッドの詳細な説明は、Numeric#coerce にあります。
@see Numeric#coerce...

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

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

...ssl'

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_bn.to_s(16) # => "09"
p 10.to_bn.to_s(16) # => "0A"
p 16.to_bn.to_s(16) # => "10"
p 26.to_bn.to_s(16) # => "1A"
p 256.to_bn.to_s(16) # => "0100"

p 0.to_bn.to_s(2) # => ""
p 6.to_bn.to_s(2) #...
...=> "\x06"
p 7.to_bn.to_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 を用います。

@s...

OpenSSL::BN.new(integer) -> OpenSSL::BN (42.0)

整数オブジェクト(Integer)から多倍長整数オブジェクト (OpenSSL::BN)を生成します。

...整数オブジェクト(Integer)から多倍長整数オブジェクト
(OpenSSL::BN)を生成します。

@param integer 整数オブジェクト
@see Integer#to_bn...

絞り込み条件を変える

OpenSSL::BN.new(bn) -> OpenSSL::BN (27.0)

OpenSSL::BN を複製して返します。

OpenSSL::BN を複製して返します。

@param bn 複製する OpenSSL::BN オブジェクト

OpenSSL::BN.new(str, base=10) -> OpenSSL::BN (27.0)

文字列を多倍長整数オブジェクト(OpenSSL::BN)を生成します。

文字列を多倍長整数オブジェクト(OpenSSL::BN)を生成します。

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

10 引数の文字列を 10進数とみなして、変換します。
16 引数の文字列を 16進数とみなして、変換します。
2 引数の文字列を big-endian の符号無し整数のバイナリ列とみなして、変換します。
0 引数の文字列を MPI形式の文字列(バイト列)とみなして、変換します。
(最初の4byteはbig-endianでデータ長を表わし、その後にそのデータ長のバイト...

OpenSSL::BN#pretty_print(pp) (18.0)

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

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

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

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

@param pp 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#mask_bits!(n) -> self (12.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 マスクするビット数
@rais...
<< 1 2 > >>