bls12-381 0.2.2 → 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: 6b881234573ce97de2f335ffb3fc245e2c0ab586dc66b881e6caa9fdc09b623c
4
- data.tar.gz: c5aeaeaab593ddfa9053a729a590ccef8c1d01ccdc8219bb9ce90be9e165f644
3
+ metadata.gz: 12a6fb08835177232951b7e8e4542859d445d083039002d0c4bf3bf642bde133
4
+ data.tar.gz: 5a765594ccedfafb7e7794575e475a239260e611612393fba95beadfc30de7dd
5
5
  SHA512:
6
- metadata.gz: 40a7ac130ea64f950cd0a6e13107ebe0a4d62a4281828f0ecd7a19a133939d27e2eacf773eb0101b7d0790e77a2df736d3d351c0cb6bb33bd7bb393dd757d9cf
7
- data.tar.gz: a733451aaa70fcb037aed82f45bd0aa1abe58519a276dd81c9b8d8b7cbcf470ec7358b914b10d0cf9049187e5fcf798138410cc4ca4186112aa30909cc2941f9
6
+ metadata.gz: b7f1049bd3f13451f38f037bfaee2a886f9b3b821e1d55b57985f4e954219f684be96f3d4d3d85ad98129a8574593c1fe3cc0d7d7d5ce104e5f903f332758025
7
+ data.tar.gz: 18bdcba6350009adcc6f176b2b1ea37a01226b03a8c82005c6fe0f32a556a0f5eb0eb66dcc2c3c0f38972a62ce8cd66ed3126679b953cf423a0fadfbd5fb58f1
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'