るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Integer#to_bn -> OpenSSL::BN (18120.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]{
class 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]{
class Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new...

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

自分自身を返します。

自分自身を返します。

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

点を整数に変換します。

点を整数に変換します。

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

OpenSSL::BN#to_s(base=10) -> String (85.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#num_bytes -> Integer (31.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
//}...

絞り込み条件を変える

OpenSSL::BN#negative? -> bool (19.0)

自身が負である場合に true を返します。Ruby 2.5, OpenSSL 2.1.0 から利用できます。

...自身が負である場合に true を返します。Ruby 2.5, OpenSSL 2.1.0 から利用できます。

//emlist[][ruby]{
require 'openssl'
p 15.to_bn.negative? # => false
p 0.to_bn.negative? # => false
p (-5).to_bn.negative? # => true
//}...

OpenSSL::BN#pretty_print(pp) (13.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#<<(other) -> OpenSSL::BN (7.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 (7.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#coerce(other) -> Array (7.0)

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

...ジェクト] にして返します。
それ以外の場合は例外 TypeError を発生させます。

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

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

絞り込み条件を変える

<< 1 2 > >>