152件ヒット
[1-100件を表示]
(0.147秒)
ライブラリ
- openssl (152)
クラス
- Integer (12)
-
OpenSSL
:: BN (128) -
OpenSSL
:: PKey :: EC :: Point (12)
キーワード
- << (12)
- >> (12)
- coerce (12)
- lshift! (12)
-
mask
_ bits! (12) - negative? (8)
-
num
_ bytes (12) -
pretty
_ print (12) - rshift! (12)
-
to
_ s (12)
検索結果
先頭5件
-
Integer
# to _ bn -> OpenSSL :: BN (24220.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]{
clas......s 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 # to _ bn -> self (24202.0) -
自分自身を返します。
自分自身を返します。 -
OpenSSL
:: PKey :: EC :: Point # to _ bn -> OpenSSL :: BN (24202.0) -
点を整数に変換します。
...点を整数に変換します。
@raise OpenSSL::PKey::EC::Point::Error 変換に失敗した場合に発生します... -
OpenSSL
:: BN # num _ bytes -> Integer (6231.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 # to _ s(base=10) -> String (6185.0) -
自身を表す文字列を返します。
.../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:... -
OpenSSL
:: BN # negative? -> bool (6119.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) (6113.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 # lshift!(n) -> self (6107.0) -
自身を n ビット左シフトします。 OpenSSL::BN#<<と異なり、破壊的メソッドです。
...自身を n ビット左シフトします。
OpenSSL::BN#<<と異なり、破壊的メソッドです。
//emlist[][ruby]{
require 'openssl'
bn = 1.to_bn
bn.lshift!(2) # => #<OpenSSL::BN 4>
bn # => #<OpenSSL::BN 4>
//}
@param n シフトするビット数
@raise OpenSSL::BNError... -
OpenSSL
:: BN # mask _ bits!(n) -> self (6107.0) -
自身を下位 n ビットでマスクし、破壊的に変更します。
...ビット数より大きい場合は例外 OpenSSL::BNError
が発生します。
//emlist[][ruby]{
require 'openssl'
bn = 0b1111_1111.to_bn
bn.mask_bits!(8)
p "%b" % bn # => "11111111"
bn.mask_bits!(3)
p "%b" % bn # => "111"
//}
@param n マスクするビット数
@raise OpenSSL...