るりまサーチ

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

別のキーワード

  1. pop enable_ssl
  2. pop use_ssl?
  3. pop3 enable_ssl
  4. pop disable_ssl
  5. pop3 use_ssl?

ライブラリ

クラス

キーワード

検索結果

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

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

...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.new, OpenSSL::BN#to_i...
...Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

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

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

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

//emlist[][ruby]{
class Integer
d...
...ef to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...

OpenSSL::BN#negative? -> bool (12218.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.new(integer) -> OpenSSL::BN (6306.0)

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

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

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

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

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

...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.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 を用います。

@see OpenSSL::BN.new...

OpenSSL::BN#num_bytes -> Integer (6130.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
//}...

絞り込み条件を変える