bls12-381 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 952b53216e9eeccf529ec7547cc4dc21e6a666fdc200f49172f09050967de278
4
- data.tar.gz: 60b3f46b0bd8c94cf25bfffa0fa9da003b9df30bc740bb604bcb3f2386500125
3
+ metadata.gz: 99316469ec10f56e7547ee00a2496693a9bf637f3671a252481d0cd8db826625
4
+ data.tar.gz: 58d6687cd394025e3c03981eaf4a12cf1843a859cad20a1b0790caae02027d02
5
5
  SHA512:
6
- metadata.gz: 80e3701fff445cdc50c6445fedf6cb67577a5e5ef4916fb4f97293666563474962c84ac8d757b18d53e5608075d8373c4fb3a89cd6e2bbb96cfb5ef608ebc124
7
- data.tar.gz: f1e23e6abf7d5c17a1b7b7ea0413e2ff18d0ca8901f10a854f63b8043fa0b1ceb4598c8897d17830445b0574ef8b3cdbe1bf9fbac5b455d3c673dcb3c683fc62
6
+ metadata.gz: be64b1239722876a9fb0e4c3b0326e90d1fcbf945bb1d3f01e66c468f6213653c7c30b9caa743ac8438d404602bcf5279c7192237362139229615e226949f18b
7
+ data.tar.gz: 21904be1eb488d0f856a7aeec9b8c5d3275ebd6d6d5be9cd7388d0aeff816f15480136f13498e6ae540dfdca0e3bd6cb7ed6fc941218eaf2b06d781daa1400f2
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.0.0
1
+ ruby-3.1.2
data/lib/bls/pairing.rb CHANGED
@@ -7,8 +7,11 @@ module BLS
7
7
  # @param [BLS::PointG2] q
8
8
  # @param [Boolean] with_final_exp
9
9
  # @return [BLS::Fq12]
10
- # @return [BLS::PairingError] Occur when p.zero? or q.zero?
10
+ # @raise [BLS::PairingError] Occur when p.zero? or q.zero?
11
+ # @raise [ArgumentError]
11
12
  def pairing(p, q, with_final_exp: true)
13
+ raise ArgumentError, 'p should be BLS::PointG1 object' unless p.is_a?(BLS::PointG1)
14
+ raise ArgumentError, 'q should be BLS::PointG2 object' unless q.is_a?(BLS::PointG2)
12
15
  raise PairingError, 'No pairings at point of Infinity' if p.zero? || q.zero?
13
16
 
14
17
  p.validate!
data/lib/bls/point.rb CHANGED
@@ -101,7 +101,7 @@ module BLS
101
101
  alias - subtract
102
102
 
103
103
  def multiply_unsafe(scalar)
104
- n = scalar.is_a?(Fq) ? scalar.value : scalar
104
+ n = scalar.is_a?(Field) ? scalar.value : scalar
105
105
  raise PointError, 'Point#multiply: invalid scalar, expected positive integer' if n <= 0
106
106
 
107
107
  p = zero
@@ -151,7 +151,7 @@ module BLS
151
151
 
152
152
  # Constant time multiplication. Uses wNAF.
153
153
  def multiply(scalar)
154
- n = scalar.is_a?(Fq) ? scalar.value : scalar
154
+ n = scalar.is_a?(Field) ? scalar.value : scalar
155
155
  raise PointError, 'Invalid scalar, expected positive integer' if n <= 0
156
156
  raise PointError, "Scalar has more bits than maxBits, shouldn't happen" if n.bit_length > max_bits
157
157
 
data/lib/bls/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BLS
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bls12-381
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shigeyuki Azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-07 00:00:00.000000000 Z
11
+ date: 2023-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.2.3
89
+ rubygems_version: 3.3.23
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: BLS12-381 implementation for Ruby.