schnorr_sig 0.0.0.3 → 0.0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -24
- data/VERSION +1 -1
- data/lib/schnorr_sig/util.rb +1 -1
- data/test/vectors.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd55fdf9335f6ea817837d76d3ce130f9752ab7cbf582c822e061dc68574583
|
4
|
+
data.tar.gz: dbc20c45aac2f0d9443d278a93ff6e7ae88cea2fc26b68eaf5226c6dd47979bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e180ad80feddacf2ee05dd4a66d8518a53233ac56ba393917bac45e19e5cae25530e87aacdcd330523ce6751e2fb754efc5359571a564db21197d7063bb3e737
|
7
|
+
data.tar.gz: fc67524a97a42b517efff14b7c4bcc21732d8f6e83a353d51220f3e7627aab646edce9e25fd9676f6f7e13bc62eceb3d52062bdbc234a0d640dfe3eba7f78086
|
data/README.md
CHANGED
@@ -14,24 +14,6 @@ and specifications similar to
|
|
14
14
|
[IETF RFCs](https://en.wikipedia.org/wiki/Request_for_Comments).
|
15
15
|
BIP340 specifies elliptic curve `secp256k1` for use with Schnorr signatures.
|
16
16
|
|
17
|
-
Two separate implementations are provided.
|
18
|
-
|
19
|
-
## Ruby Implementation
|
20
|
-
|
21
|
-
This is the default implementation: entirely Ruby code within this library,
|
22
|
-
with mostly-Ruby dependencies:
|
23
|
-
|
24
|
-
* [ecdsa_ext](https://github.com/azuchi/ruby_ecdsa_ext)
|
25
|
-
- [ecdsa](https://github.com/DavidEGrayson/ruby_ecdsa/)
|
26
|
-
|
27
|
-
## "Fast" Implementation
|
28
|
-
|
29
|
-
This is based on the [rbsecp256k1](https://github.com/etscrivner/rbsecp256k1)
|
30
|
-
gem, which is not installed by default. The gem wraps the
|
31
|
-
[secp256k1](https://github.com/bitcoin-core/secp256k1) library from the
|
32
|
-
Bitcoin project, which provides battle-tested performance, correctness, and
|
33
|
-
security guarantees.
|
34
|
-
|
35
17
|
# Usage
|
36
18
|
|
37
19
|
This library is provided as a RubyGem. It has a single dependency on
|
@@ -95,9 +77,9 @@ require 'schnorr_sig/fast' # not 'schnorr_sig'
|
|
95
77
|
# Elliptic Curves
|
96
78
|
|
97
79
|
Note that [elliptic curves](https://en.wikipedia.org/wiki/Elliptic_curve)
|
98
|
-
are not ellipses, but
|
80
|
+
are not ellipses, but can instead be described by cubic equations of
|
99
81
|
the form: `y^2 = x^3 + ax + b` where `a` and `b` are the parameters of the
|
100
|
-
resulting
|
82
|
+
resulting curve. All points `(x, y)` which satisfy a given parameterized
|
101
83
|
equation provide the exact definition of an elliptic curve.
|
102
84
|
|
103
85
|
## Curve `secp256k1`
|
@@ -122,11 +104,11 @@ Here is one
|
|
122
104
|
}
|
123
105
|
```
|
124
106
|
|
125
|
-
* `p` is the prime for the Field, below
|
107
|
+
* `p` is the prime for the Field, below INTMAX(32) (256^32)
|
126
108
|
* `a` is zero, as above
|
127
109
|
* `b` is seven, as above
|
128
|
-
* `g` is the generator point:
|
129
|
-
* `n` is the Group order, significantly below
|
110
|
+
* `g` is the generator point: [x, y]
|
111
|
+
* `n` is the Group order, significantly below INTMAX(32)
|
130
112
|
|
131
113
|
Elliptic curves have algebraic structures called
|
132
114
|
[Groups](https://en.wikipedia.org/wiki/Group_\(mathematics\)) and
|
@@ -242,7 +224,6 @@ required.
|
|
242
224
|
* For any given x-value on the curve, the y-value is easily generated
|
243
225
|
* For most curves, there are two different y-values for an x-value
|
244
226
|
* We are always dealing with 32-byte integers: **Bignums**
|
245
|
-
* Bignum math can be expensive
|
246
227
|
* Converting between integer format and 32-byte strings can be expensive
|
247
228
|
* The Schnorr algorithm requires lots of `string <--> integer` conversion
|
248
229
|
* Hex strings are never used internally
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.0.
|
1
|
+
0.0.0.4
|
data/lib/schnorr_sig/util.rb
CHANGED
@@ -18,7 +18,7 @@ module SchnorrSig
|
|
18
18
|
def self.bytestring!(str, size)
|
19
19
|
string!(str)
|
20
20
|
raise(EncodingError, str.encoding) unless str.encoding == Encoding::BINARY
|
21
|
-
str.
|
21
|
+
str.size == size or raise(SizeError, str.size)
|
22
22
|
end
|
23
23
|
|
24
24
|
# likely returns a Bignum, larger than a 64-bit hardware integer
|
data/test/vectors.rb
CHANGED