7件ヒット
[1-7件を表示]
(0.152秒)
ライブラリ
- openssl (7)
キーワード
-
clear
_ bit! (1) - coerce (1)
-
mask
_ bits! (1) -
mod
_ add (1) -
prime
_ fasttest? (1) -
set
_ bit! (1) -
to
_ s (1)
検索結果
先頭5件
-
OpenSSL
:: BN # clear _ bit!(n) -> self (18361.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 # mask _ bits!(n) -> self (18307.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 # mod _ add(other , m) -> OpenSSL :: BN (18307.0) -
(self + other) % m を返します。
...(self + other) % m を返します。
//emlist[][ruby]{
require 'openssl'
OpenSSL::BN.new("7").mod_add(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 4
//}
@param other 和を取る数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー... -
OpenSSL
:: BN # prime _ fasttest?(checks=nil , vtrivdiv=true) -> bool (18307.0) -
自身が素数であるなら true を返します。
...ある
OpenSSL::BN.new("181").prime_fasttest?(nil, true) # => false
OpenSSL::BN.new("181").prime_fasttest?(nil, false) # => true
//}
@param checks Miller-Robin法の繰り返しの回数
@param vtrivdiv 真なら小さな素数で割ることでの素数判定を試みます
@raise OpenSSL::BNError......判定時にエラーが発生
@see OpenSSL::BN#prime?... -
OpenSSL
:: BN # to _ s(base=10) -> String (379.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... -
OpenSSL
:: BN # coerce(other) -> Array (307.0) -
自身と other が同じクラスになるよう、自身か other を変換し [other, self] という配列にして返します。
自身と other が同じクラスになるよう、自身か other を変換し
[other, self] という配列にして返します。
基本的に other が整数のときに、自身を Integer のオブジェクトに
変換して [other, 変換後オブジェクト] にして返します。
それ以外の場合は例外 TypeError を発生させます。
//emlist[][ruby]{
require 'openssl'
p 1.to_bn.coerce(2) # => [2, 1]
//}
@param other 変換の基準となるオブジェクト
@raise TypeError 変換に失敗した場合に発... -
OpenSSL
:: BN # set _ bit!(n) -> self (61.0) -
自身の n ビット目を1にします。
...自身の n ビット目を1にします。
//emlist[][ruby]{
require 'openssl'
a = OpenSSL::BN.new("128")
a.set_bit!(0)
a # => 129
//}
@param n 1にするビットの位置
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::clear_bit!, OpenSSL::bit_set?...