ecdsa_ext 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ecdsa/ext/point.rb +12 -0
- data/lib/ecdsa/ext/projective_point.rb +8 -1
- data/lib/ecdsa/ext/version.rb +1 -1
- data/lib/ecdsa/ext.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f115741184aa3013de736e9693506b7c6d90191b648658ab6f3215da2172a3
|
4
|
+
data.tar.gz: d85bd0930d0c62d4abeb62445a950566d80b625339433d40eb3f9ed165c68d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44fbb5bef58b93924b9f5128663d83840dbe3c465fdd5c3abc36c798a34d797bf9dd98233ebc5a3260b21c323fe1466c4251282a840bd2d1e23e70d85d6f2de5
|
7
|
+
data.tar.gz: 5f31293b891b21fd42074b1d550f16ad844a5903e47be45e95c5c35ce14e38250941ac830470f707d2d990a80bf9f3db821f4f6b271d9d0cdaa38d25746ba17d
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ECDSA
|
4
|
+
# Extension of ECDSA::Point class.
|
5
|
+
class Point
|
6
|
+
# Convert coordinates to projective point.
|
7
|
+
# @return [ECDSA::Ext::ProjectivePoint]
|
8
|
+
def to_projective
|
9
|
+
ECDSA::Ext::ProjectivePoint.from_affine(self)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -145,7 +145,14 @@ module ECDSA
|
|
145
145
|
|
146
146
|
def ==(other)
|
147
147
|
return false unless other.is_a?(ProjectivePoint)
|
148
|
-
|
148
|
+
return true if infinity? && other.infinity?
|
149
|
+
|
150
|
+
lhs_x = field.mod(x * other.z)
|
151
|
+
rhs_x = field.mod(other.x * z)
|
152
|
+
lhs_y = field.mod(y * other.z)
|
153
|
+
rhs_y = field.mod(other.y * z)
|
154
|
+
|
155
|
+
lhs_x == rhs_x && lhs_y == rhs_y
|
149
156
|
end
|
150
157
|
end
|
151
158
|
end
|
data/lib/ecdsa/ext/version.rb
CHANGED
data/lib/ecdsa/ext.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecdsa_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- bin/setup
|
47
47
|
- ecdsa_ext.gemspec
|
48
48
|
- lib/ecdsa/ext.rb
|
49
|
+
- lib/ecdsa/ext/point.rb
|
49
50
|
- lib/ecdsa/ext/point_arithmetic.rb
|
50
51
|
- lib/ecdsa/ext/projective_point.rb
|
51
52
|
- lib/ecdsa/ext/version.rb
|