bls12-381 0.2.1 → 0.3.0

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: 99316469ec10f56e7547ee00a2496693a9bf637f3671a252481d0cd8db826625
4
- data.tar.gz: 58d6687cd394025e3c03981eaf4a12cf1843a859cad20a1b0790caae02027d02
3
+ metadata.gz: 12a6fb08835177232951b7e8e4542859d445d083039002d0c4bf3bf642bde133
4
+ data.tar.gz: 5a765594ccedfafb7e7794575e475a239260e611612393fba95beadfc30de7dd
5
5
  SHA512:
6
- metadata.gz: be64b1239722876a9fb0e4c3b0326e90d1fcbf945bb1d3f01e66c468f6213653c7c30b9caa743ac8438d404602bcf5279c7192237362139229615e226949f18b
7
- data.tar.gz: 21904be1eb488d0f856a7aeec9b8c5d3275ebd6d6d5be9cd7388d0aeff816f15480136f13498e6ae540dfdca0e3bd6cb7ed6fc941218eaf2b06d781daa1400f2
6
+ metadata.gz: b7f1049bd3f13451f38f037bfaee2a886f9b3b821e1d55b57985f4e954219f684be96f3d4d3d85ad98129a8574593c1fe3cc0d7d7d5ce104e5f903f332758025
7
+ data.tar.gz: 18bdcba6350009adcc6f176b2b1ea37a01226b03a8c82005c6fe0f32a556a0f5eb0eb66dcc2c3c0f38972a62ce8cd66ed3126679b953cf423a0fadfbd5fb58f1
@@ -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: 3.0.0
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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # BLS12-381 for Ruby [![Build Status](https://github.com/azuchi/bls12-381/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/azuchi/bls12-381/actions/workflows/main.yml/badge.svg?branch=main) [![Gem Version](https://badge.fury.io/rb/bls12-381.svg)](https://badge.fury.io/rb/bls12-381) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
2
2
 
3
3
  This library is a Ruby BLS12-381 implementation based on the JavaScript implementation [noble-bls12-381](https://github.com/paulmillr/noble-bls12-381).
4
+ In addition to that, it is possible to switch between public key and signature group (G1 and G2).
4
5
 
5
6
  Note: This library has passed the same tests as noble-bls12-381, but has not been audited to prove its safety.
6
7
  Please be careful when using this.
@@ -35,12 +36,14 @@ private_key = '67d53f170b908cabb9eb326c3c337762d59289a8fec79f7bc9254b584b73265c'
35
36
  # Generate public key from private key.
36
37
  public_key = BLS.get_public_key(private_key)
37
38
  # Public key is BLS::PointG1 object.
39
+ # If you want to use BLS::PointG2 public key, use BLS.get_public_key(p, key_type: :g2)
38
40
 
39
41
  # sign and verify
40
42
  message = '64726e3da8'
41
43
 
42
44
  signature = BLS.sign(message, private_key)
43
- # signature is BLS::PointG2 object. You can get signature with hex format using #to_signature method.
45
+ # signature is BLS::PointG2 object. You can get signature with hex format using #to_hex method.
46
+ # If you want to use BLS::PointG1 signature, use BLS.sign(message, p, sig_type: :g1)
44
47
  signature.to_signature
45
48
 
46
49
  is_correct = BLS.verify(signature, message, public_key)
@@ -53,7 +56,6 @@ private_keys = [
53
56
  '16ae669f3be7a2121e17d0c68c05a8f3d6bef21ec0f2315f1d7aec12484e4cf5'
54
57
  ]
55
58
  public_keys = private_keys.map { |p| BLS.get_public_key(p) }
56
-
57
59
  signatures2 = private_keys.map { |p| BLS.sign(message, p) }
58
60
  agg_public_keys2 = BLS.aggregate_public_keys(public_keys)
59
61
  agg_signatures2 = BLS.aggregate_signatures(signatures2)
@@ -74,4 +76,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
74
76
 
75
77
  ## Code of Conduct
76
78
 
77
- Everyone interacting in the Bls12::381 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bls12-381/blob/master/CODE_OF_CONDUCT.md).
79
+ Everyone interacting in the BlS12-381 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/bls12-381/blob/master/CODE_OF_CONDUCT.md).
data/bls12-381.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ['lib']
28
28
 
29
29
  # Uncomment to register a new dependency of your gem
30
- # spec.add_dependency "example-gem", "~> 1.0"
30
+ spec.add_dependency "h2c", "~> 0.2.0"
31
31
 
32
32
  spec.add_development_dependency 'bundler'
33
33
  spec.add_development_dependency 'rake', '>= 12.3.3'