bip-schnorr 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b728c49a4a5ce1d674d0db21d5e7dfd2771bd5f13f20a368ac95fdf42c8b2fcd
4
- data.tar.gz: fd169afb436506a4e6797c3593331d83773ab79762625f53754d549f2e93a2c5
3
+ metadata.gz: 62086f5dc865721a602e4ac25f1c58920eba47d0e7bb5ab59d389af297095750
4
+ data.tar.gz: 3e6ddfbc75956f04e84f01412b034974cb592ef1adea72775acdc949946d2ebf
5
5
  SHA512:
6
- metadata.gz: 38a011fd1d9fd3e5285065d42a7a9fd3fed8a15cb4b40e3b4975dbae3d3ed314c7b9c54d649b3a360c273828c6da91d0624fdb255d02ef4018da2d27af8cdf94
7
- data.tar.gz: a1cc7d6de6e931ae81ee5f9144505c7af14da0bc9e6fb35f999bd163d3650378d357072923ceb8744b1627386dbbb0d12b6483161ef5b3f8c03f928fe10d8d90
6
+ metadata.gz: 4f599b83ba35a76df8425eb7eb436740f690ec011dcfc6eac65af1591bb748d1421dd71d2cf15c480e44302bd821ffda6f385799549a37f2a8159a592c510482
7
+ data.tar.gz: f7cb59f75a709bb05509697a55bd3864944a82d4a9768bc34db84da0b6a215b9060fa875722ebb597731f3df6a4155e738b419c413b5ef06278378f2b3055627
@@ -20,10 +20,9 @@ jobs:
20
20
  strategy:
21
21
  matrix:
22
22
  ruby:
23
- - '2.7.7'
24
- - '3.0.5'
25
- - '3.1.3'
26
- - '3.2.1'
23
+ - '3.0.6'
24
+ - '3.1.4'
25
+ - '3.2.2'
27
26
  steps:
28
27
  - uses: actions/checkout@v2
29
28
  - name: Set up Ruby
@@ -1,3 +1,3 @@
1
1
  module Schnorr
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
data/lib/schnorr.rb CHANGED
@@ -10,12 +10,14 @@ module Schnorr
10
10
  module_function
11
11
 
12
12
  GROUP = ECDSA::Group::Secp256k1
13
+ DEFAULT_AUX = ([0x00] * 32).pack('C*')
13
14
 
14
15
  # Generate schnorr signature.
15
16
  # @param [String] message A message to be signed with binary format.
16
17
  # @param [String] private_key The private key(binary format or hex format).
17
18
  # @param [String] aux_rand The auxiliary random data(binary format or hex format).
18
- # If not specified, random data is not used and the private key is used to calculate the nonce.
19
+ # If aux_rand is nil, it is treated the same as an all-zero one.
20
+ # See BIP-340 "Default Signing" for a full explanation of this argument and for guidance if randomness is expensive.
19
21
  # @return [Schnorr::Signature]
20
22
  def sign(message, private_key, aux_rand = nil)
21
23
  private_key = private_key.unpack1('H*') unless hex_string?(private_key)
@@ -25,6 +27,8 @@ module Schnorr
25
27
  if aux_rand
26
28
  aux_rand = [aux_rand].pack("H*") if hex_string?(aux_rand)
27
29
  raise 'aux_rand must be 32 bytes.' unless aux_rand.bytesize == 32
30
+ else
31
+ aux_rand = DEFAULT_AUX
28
32
  end
29
33
 
30
34
  p = (GROUP.generator.to_jacobian * d0).to_affine
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bip-schnorr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-01 00:00:00.000000000 Z
11
+ date: 2023-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ecdsa_ext