るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

キーワード

検索結果

<< < 1 2 3 >>

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

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

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

//emlist[][ruby]{
r
equire '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#to_s(base=10) -> String (109.0)

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

...し整数のバイナリ列
0 MPI形式の文字列(バイト列)

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

//emlist[][ruby]{
r
equire 'openssl'

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

p 0.to_bn.to_s...
...o_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 を用います。

@see OpenSSL::BN.new...

OpenSSL::BN#ucmp(other) -> -1 | 0 | 1 (109.0)

自身と other の絶対値を比較し、自身の絶対値が小さいときには -1、 等しいときには 0、 大きいときには 1 を返します。

...と other の絶対値を比較し、自身の絶対値が小さいときには -1、
等しいときには 0、 大きいときには 1 を返します。

//emlist[][ruby]{
r
equire 'openssl'

OpenSSL
::BN.new(-5).ucmp(5) # => 0

OpenSSL
::BN.new(5).ucmp(OpenSSL::BN.new(-9)) # => -1
OpenSSL
::BN.ne...
...w(-5).ucmp(OpenSSL::BN.new(5)) # => 0
OpenSSL
::BN.new(-5).ucmp(OpenSSL::BN.new(2)) # => 1
//}

@param other 比較する整数
@raise TypeError 比較できないときに発生します。
@see OpenSSL::BN#cmp...
<< < 1 2 3 >>