bls12-381 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +9 -1
- data/.ruby-version +1 -1
- data/lib/bls/field.rb +9 -0
- data/lib/bls/pairing.rb +4 -1
- data/lib/bls/point.rb +2 -2
- data/lib/bls/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b881234573ce97de2f335ffb3fc245e2c0ab586dc66b881e6caa9fdc09b623c
|
4
|
+
data.tar.gz: c5aeaeaab593ddfa9053a729a590ccef8c1d01ccdc8219bb9ce90be9e165f644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40a7ac130ea64f950cd0a6e13107ebe0a4d62a4281828f0ecd7a19a133939d27e2eacf773eb0101b7d0790e77a2df736d3d351c0cb6bb33bd7bb393dd757d9cf
|
7
|
+
data.tar.gz: a733451aaa70fcb037aed82f45bd0aa1abe58519a276dd81c9b8d8b7cbcf470ec7358b914b10d0cf9049187e5fcf798138410cc4ca4186112aa30909cc2941f9
|
data/.github/workflows/main.yml
CHANGED
@@ -5,12 +5,20 @@ on: [push,pull_request]
|
|
5
5
|
jobs:
|
6
6
|
build:
|
7
7
|
runs-on: ubuntu-latest
|
8
|
+
name: Ruby ${{ matrix.ruby }}
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby:
|
12
|
+
- '3.0.5'
|
13
|
+
- '3.1.3'
|
14
|
+
- '3.2.0'
|
8
15
|
steps:
|
9
16
|
- uses: actions/checkout@v2
|
10
17
|
- name: Set up Ruby
|
11
18
|
uses: ruby/setup-ruby@v1
|
12
19
|
with:
|
13
|
-
ruby-version:
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
21
|
+
bundler-cache: true
|
14
22
|
- name: Run the default task
|
15
23
|
run: |
|
16
24
|
gem install bundler -v 2.2.11
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-3.
|
1
|
+
ruby-3.1.2
|
data/lib/bls/field.rb
CHANGED
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
|
-
# @
|
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?(
|
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?(
|
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
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.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeyuki Azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-26 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.
|
89
|
+
rubygems_version: 3.3.23
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: BLS12-381 implementation for Ruby.
|