296件ヒット
[1-100件を表示]
(0.075秒)
クラス
- Integer (12)
-
OpenSSL
:: ASN1 :: ASN1Data (24) -
OpenSSL
:: BN (260)
キーワード
- << (12)
- <=> (12)
- >> (12)
-
bit
_ set? (12) -
clear
_ bit! (12) - cmp (12)
- coerce (12)
- lshift! (12)
-
mask
_ bits! (12) -
mod
_ add (12) -
mod
_ exp (12) -
mod
_ mul (12) -
mod
_ sub (12) - negative? (8)
-
num
_ bits (12) -
num
_ bytes (12) -
pretty
_ print (12) -
prime
_ fasttest? (12) - rshift! (12)
-
set
_ bit! (12) -
to
_ bn (12) -
to
_ s (12) - ucmp (12)
- value (12)
- value= (12)
検索結果
先頭5件
-
OpenSSL
:: BN # num _ bytes -> Integer (6209.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 # negative? -> bool (6125.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
//}... -
Integer
# to _ bn -> OpenSSL :: BN (6115.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 # bit _ set?(n) -> bool (6109.0) -
自身の n ビット目が立っているなら true を返します。
...自身の n ビット目が立っているなら true を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("129").bit_set?(0) # => true
OpenSSL::BN.new("129").bit_set?(1) # => false
//}
@param n 調べるビットの位置
@see OpenSSL::set_bit!... -
OpenSSL
:: BN # clear _ bit!(n) -> self (6109.0) -
自身の n ビット目を0にします。
...自身の n ビット目を0にします。
//emlist[][ruby]{
require 'openssl'
a = OpenSSL::BN.new("129")
a.clear_bit!(0)
a # => 128
//}
@param n 0にするビットの位置
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::set_bit!... -
OpenSSL
:: BN # lshift!(n) -> self (6109.0) -
自身を n ビット左シフトします。 OpenSSL::BN#<<と異なり、破壊的メソッドです。
...す。
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 計算時エラー
@see OpenSSL::BN#<<... -
OpenSSL
:: BN # mask _ bits!(n) -> self (6109.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::BNError 計算時... -
OpenSSL
:: BN # num _ bits -> Integer (6109.0) -
自身を表現するのに使っているビット数を返します。
...自身を表現するのに使っているビット数を返します。
符号は無視されます。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("127").num_bits # => 7
OpenSSL::BN.new("-127").num_bits # => 7
OpenSSL::BN.new("128").num_bits # => 8
//}... -
OpenSSL
:: BN # pretty _ print(pp) (6109.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 クラスのインスタンスオブジェクト...