るりまサーチ (Ruby 2.1.0)

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

別のキーワード

  1. string []=
  2. string []
  3. string slice
  4. string slice!
  5. string gsub

ライブラリ

検索結果

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

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

...-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 # => "...
...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...