るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

ライブラリ

キーワード

検索結果

OpenSSL::BN#to_s(base=10) -> String (214.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.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...
...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.new(integer) -> OpenSSL::BN (104.0)

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

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

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