るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
26件ヒット [1-26件を表示] (0.070秒)
トップページ > バージョン:2.4.0[x] > ライブラリ:openssl[x] > クエリ:new[x] > クエリ:openssl::bn[x]

別のキーワード

  1. openssl new
  2. openssl digest
  3. openssl to_der
  4. openssl to_s
  5. openssl hexdigest

検索結果

OpenSSL::BN.new(str, base=10) -> OpenSSL::BN (81988.0)

文字列を多倍長整数オブジェクト(OpenSSL::BN)を生成します。

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

base で、変換方法(基数)を指定します。
デフォルトは 10 で、他に 16, 2, 0 を指定できます。

10 引数の文字列を 10進数とみなして、変換します。
16 引数の文字...
...{
require 'openssl'

OpenSSL
::BN.new("-241") # => -241
OpenSSL
::BN.new("ff00",16) # => 65280
OpenSSL
::BN.new("\x81",2) # => 129
OpenSSL
::BN.new("\xff\x81",2) # => 65409
OpenSSL
::BN.new("\x00\x00\x00\x02\x00\x81", 0) # => 129
OpenSSL
::BN.new("\x00\x00\x00\x02\x80\x81", 0) # => -129
OpenSSL
::BN.new(12...
...を表す文字列
@param base 文字列から整数に変換するときの基数
@raise OpenSSL::BNError 変換に失敗した場合に発生します

反対に、OpenSSL::BN クラスのオブジェクトを文字列にするには、
OpenSSL
::BN#to_s を用います。

@see OpenSSL::BN#to_s...

OpenSSL::BN.new(bn) -> OpenSSL::BN (81748.0)

OpenSSL::BN を複製して返します。

...
OpenSSL
::BN を複製して返します。

@param bn 複製する OpenSSL::BN オブジェクト...

OpenSSL::BN.new(integer) -> OpenSSL::BN (81733.0)

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

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

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

OpenSSL::PKey::EC::Group.new(obj) -> OpenSSL::PKey::EC::Group (54367.0)

楕円曲線から定義される群を表すオブジェクトを生成します。

...ブジェクトを生成します。

引数の種類と個数によって挙動が異なります。

引数が1つの場合は、シンボル、OpenSSL::PKey::EC::Group オブジェクト、
文字列のいずれかを渡すことができます。

引数にシンボルを渡した場合は対応...
...す。
* :GFp_simple
* :GFp_mont
* :GFp_nist
* :GF2m_simple
この方法で生成された Group オブジェクトは不完全です。

OpenSSL
::PKey::EC::Group オブジェクト
を渡した場合はそれを複製したオブジェクトを返します。

文字列を渡した場合は...
...、Group, 文字列のいずれか)
@param sym Group を定義するためのシンボル
@param p 整数(OpenSSL::BN)
@param a 整数(OpenSSL::BN)
@param b 整数(OpenSSL::BN)
@raise OpenSSL::PKey::EC::Group::Error オブジェクトの生成に失敗した場合に発生します。
曲線...

OpenSSL::PKey::EC::Group.new(sym, p, a, b) -> OpenSSL::PKey::EC::Group (54367.0)

楕円曲線から定義される群を表すオブジェクトを生成します。

...ブジェクトを生成します。

引数の種類と個数によって挙動が異なります。

引数が1つの場合は、シンボル、OpenSSL::PKey::EC::Group オブジェクト、
文字列のいずれかを渡すことができます。

引数にシンボルを渡した場合は対応...
...す。
* :GFp_simple
* :GFp_mont
* :GFp_nist
* :GF2m_simple
この方法で生成された Group オブジェクトは不完全です。

OpenSSL
::PKey::EC::Group オブジェクト
を渡した場合はそれを複製したオブジェクトを返します。

文字列を渡した場合は...
...、Group, 文字列のいずれか)
@param sym Group を定義するためのシンボル
@param p 整数(OpenSSL::BN)
@param a 整数(OpenSSL::BN)
@param b 整数(OpenSSL::BN)
@raise OpenSSL::PKey::EC::Group::Error オブジェクトの生成に失敗した場合に発生します。
曲線...

絞り込み条件を変える

OpenSSL::PKey::EC::Point.new(group) -> OpenSSL::PKey::EC::Point (54334.0)

Point オブジェクトを生成します。

...します。

引数に OpenSSL::PKey::EC::Point オブジェクトを渡した場合は
それを複製します。

引数に OpenSSL::PKey::EC::Group オブジェクトを渡した場合は
それに関連付けられたオブジェクトを返します。

引数に OpenSSL::PKey::EC::Group オ...
...る点を返します。

@param point 複製する OpenSSL::PKey::EC::Point オブジェクト
@param group 関連付ける群(OpenSSL::PKey::EC::Group オブジェクト)
@param bn 点を表す整数(OpenSSL::BN オブジェクト)
@raise OpenSSL::PKey::EC::Point::Error オブジェクトの生成...

OpenSSL::PKey::EC::Point.new(group, bn) -> OpenSSL::PKey::EC::Point (54334.0)

Point オブジェクトを生成します。

...します。

引数に OpenSSL::PKey::EC::Point オブジェクトを渡した場合は
それを複製します。

引数に OpenSSL::PKey::EC::Group オブジェクトを渡した場合は
それに関連付けられたオブジェクトを返します。

引数に OpenSSL::PKey::EC::Group オ...
...る点を返します。

@param point 複製する OpenSSL::PKey::EC::Point オブジェクト
@param group 関連付ける群(OpenSSL::PKey::EC::Group オブジェクト)
@param bn 点を表す整数(OpenSSL::BN オブジェクト)
@raise OpenSSL::PKey::EC::Point::Error オブジェクトの生成...

OpenSSL::PKey::EC::Point.new(point) -> OpenSSL::PKey::EC::Point (54334.0)

Point オブジェクトを生成します。

...します。

引数に OpenSSL::PKey::EC::Point オブジェクトを渡した場合は
それを複製します。

引数に OpenSSL::PKey::EC::Group オブジェクトを渡した場合は
それに関連付けられたオブジェクトを返します。

引数に OpenSSL::PKey::EC::Group オ...
...る点を返します。

@param point 複製する OpenSSL::PKey::EC::Point オブジェクト
@param group 関連付ける群(OpenSSL::PKey::EC::Group オブジェクト)
@param bn 点を表す整数(OpenSSL::BN オブジェクト)
@raise OpenSSL::PKey::EC::Point::Error オブジェクトの生成...

OpenSSL::ASN1::Integer.new(value) -> OpenSSL::ASN1::Integer (54331.0)

ASN.1 の Integer 型の値を表現する OpenSSL::ASN1::Integer オブジェクトを 生成します。

...値を表現する OpenSSL::ASN1::Integer オブジェクトを
生成します。

value 以外の引数を省略した場合はタグクラスは :UNIVERSAL、
タグ は OpenSSL::ASN1::INTEGER となります。

@param value ASN.1 値を表す Ruby のオブジェクト(OpenSSL::BNのインス...

OpenSSL::ASN1::Integer.new(value, tag, tagging, tag_class) -> OpenSSL::ASN1::Integer (54331.0)

ASN.1 の Integer 型の値を表現する OpenSSL::ASN1::Integer オブジェクトを 生成します。

...値を表現する OpenSSL::ASN1::Integer オブジェクトを
生成します。

value 以外の引数を省略した場合はタグクラスは :UNIVERSAL、
タグ は OpenSSL::ASN1::INTEGER となります。

@param value ASN.1 値を表す Ruby のオブジェクト(OpenSSL::BNのインス...

絞り込み条件を変える

OpenSSL::BN#mod_add(other, m) -> OpenSSL::BN (27418.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#mod_exp(other, m) -> OpenSSL::BN (27418.0)

(self ** other) % m を返します。

...(self ** other) % m を返します。

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

OpenSSL
::BN.new("7").mod_exp(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 1
//}

@param other 指数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー...

OpenSSL::BN#mod_mul(other, m) -> OpenSSL::BN (27418.0)

(self * other) % m を返します。

...(self * other) % m を返します。

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

OpenSSL
::BN.new("7").mod_mul(OpenSSL::BN.new("3"), OpenSSL::BN.new("6")) # => 3
//}

@param other 積を取る数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー...

OpenSSL::BN#mod_sub(other, m) -> OpenSSL::BN (27418.0)

(self - other) % m を返します。

...(self - other) % m を返します。

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

OpenSSL
::BN.new("27").mod_sub(OpenSSL::BN.new("3"), OpenSSL::BN.new("5")) # => 4
//}

@param other 引く数
@param m 剰余を取る数
@raise OpenSSL::BNError 計算時エラー...

OpenSSL::BN#<=>(other) -> -1 | 0 | 1 (27277.0)

自身と other を比較し、自身が小さいときには -1、 等しいときには 0、大きいときには 1 を返します。

...ときには 1 を返します。

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

OpenSSL
::BN.new(5) <=> 5 # => 0

OpenSSL
::BN.new(5) <=> OpenSSL::BN.new(9) # => -1
OpenSSL
::BN.new(5) <=> OpenSSL::BN.new(5) # => 0
OpenSSL
::BN.new(5) <=> OpenSSL::BN.new(-5) # => 1
//}

@param other 比較する整数
@r...
...aise TypeError 比較できないときに発生します。
@see OpenSSL::BN#ucmp...

絞り込み条件を変える

OpenSSL::BN#cmp(other) -> -1 | 0 | 1 (27277.0)

自身と other を比較し、自身が小さいときには -1、 等しいときには 0、大きいときには 1 を返します。

...ときには 1 を返します。

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

OpenSSL
::BN.new(5) <=> 5 # => 0

OpenSSL
::BN.new(5) <=> OpenSSL::BN.new(9) # => -1
OpenSSL
::BN.new(5) <=> OpenSSL::BN.new(5) # => 0
OpenSSL
::BN.new(5) <=> OpenSSL::BN.new(-5) # => 1
//}

@param other 比較する整数
@r...
...aise TypeError 比較できないときに発生します。
@see OpenSSL::BN#ucmp...

OpenSSL::BN#ucmp(other) -> -1 | 0 | 1 (27277.0)

自身と other の絶対値を比較し、自身の絶対値が小さいときには -1、 等しいときには 0、 大きいときには 1 を返します。

...には 1 を返します。

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

OpenSSL
::BN.new(-5).ucmp(5) # => 0

OpenSSL
::BN.new(5).ucmp(OpenSSL::BN.new(-9)) # => -1
OpenSSL
::BN.new(-5).ucmp(OpenSSL::BN.new(5)) # => 0
OpenSSL
::BN.new(-5).ucmp(OpenSSL::BN.new(2)) # => 1
//}

@param other 比較する整...
...
@raise TypeError 比較できないときに発生します。
@see OpenSSL::BN#cmp...

OpenSSL::BN#num_bits -> Integer (27115.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#prime_fasttest?(checks=nil, vtrivdiv=true) -> bool (27097.0)

自身が素数であるなら true を返します。

...繰り返します。
checksがnilである場合は OpenSSL が適切な
回数を判断します。

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

# 181 は 「小さな素数」である
OpenSSL
::BN.new("181").prime_fasttest?(nil, true) # => false
OpenSSL
::BN.new("181").prime_fasttest?(nil, false) # => tr...
...ue
//}

@param checks Miller-Robin法の繰り返しの回数
@param vtrivdiv 真なら小さな素数で割ることでの素数判定を試みます
@raise OpenSSL::BNError 判定時にエラーが発生
@see OpenSSL::BN#prime?...

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

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

...
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_...
...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#bit_set?(n) -> bool (27079.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 (27043.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#set_bit!(n) -> self (27043.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?...

Integer#to_bn -> OpenSSL::BN (484.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...

OpenSSL::ASN1.#Integer(value) -> OpenSSL::ASN1::Integer (43.0)

ASN.1 の Integer 型の値を表現する Ruby のオブジェクトを 生成します。

...ASN.1 の Integer 型の値を表現する Ruby のオブジェクトを
生成します。

OpenSSL
::ASN1::Integer.new と同じです。

@param value ASN.1 値を表す Ruby のオブジェクト(OpenSSL::BNのインスタンス)
@param tag タグ番号
@param tagging タグ付けの方法(:IMPLI...

絞り込み条件を変える

OpenSSL::ASN1.#Integer(value, tag, tagging, tag_class) -> OpenSSL::ASN1::Integer (43.0)

ASN.1 の Integer 型の値を表現する Ruby のオブジェクトを 生成します。

...ASN.1 の Integer 型の値を表現する Ruby のオブジェクトを
生成します。

OpenSSL
::ASN1::Integer.new と同じです。

@param value ASN.1 値を表す Ruby のオブジェクト(OpenSSL::BNのインスタンス)
@param tag タグ番号
@param tagging タグ付けの方法(:IMPLI...