bip-schnorr 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +3 -4
- data/lib/schnorr/version.rb +1 -1
- data/lib/schnorr.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62086f5dc865721a602e4ac25f1c58920eba47d0e7bb5ab59d389af297095750
|
4
|
+
data.tar.gz: 3e6ddfbc75956f04e84f01412b034974cb592ef1adea72775acdc949946d2ebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f599b83ba35a76df8425eb7eb436740f690ec011dcfc6eac65af1591bb748d1421dd71d2cf15c480e44302bd821ffda6f385799549a37f2a8159a592c510482
|
7
|
+
data.tar.gz: f7cb59f75a709bb05509697a55bd3864944a82d4a9768bc34db84da0b6a215b9060fa875722ebb597731f3df6a4155e738b419c413b5ef06278378f2b3055627
|
data/.github/workflows/ruby.yml
CHANGED
data/lib/schnorr/version.rb
CHANGED
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
|
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.
|
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-
|
11
|
+
date: 2023-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ecdsa_ext
|