ecdsa_ext 0.3.0 → 0.3.2
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/jacobian_point.rb +14 -14
- data/lib/ecdsa/ext/version.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: f677f4ad2748b8deece8f2372fc76ffcbcf0f2e951914ea621a97b7654cf847b
|
4
|
+
data.tar.gz: fd05c8a9404150adb80d34ac25ded983509739c6cdb8e96abc59305c18873629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2f252817dbb9f94a6fd0f23dffc2d6351450bf8a7c1a324c8e200e9b7aa573be30af9b2b20c5d2ac9d3ca407a50d3988d74a6f6bebeecf2f622a3577e44f7e
|
7
|
+
data.tar.gz: ef7b1b7db62bc607729cbee51114a6096cc715062d31680ec28af61165f6b95f03a126627c4a69a3ef520520bd0518426cc916f6dc45d633740223d10effb619
|
@@ -26,7 +26,7 @@ module ECDSA
|
|
26
26
|
group.field
|
27
27
|
end
|
28
28
|
|
29
|
-
# Convert coordinates from affine to
|
29
|
+
# Convert coordinates from affine to jacobian.
|
30
30
|
# @param [ECDSA::Point] point
|
31
31
|
# @return [ECDSA::Ext::JacobianPoint]
|
32
32
|
def self.from_affine(point)
|
@@ -71,19 +71,19 @@ module ECDSA
|
|
71
71
|
return other if y.zero? || z.zero?
|
72
72
|
return self if other.y.zero? || other.z.zero?
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
unless x == other.x
|
75
|
+
if z == other.z
|
76
|
+
return(
|
77
|
+
z == 1 ? add_with_z_one(self, other) : add_with_z_eq(self, other)
|
78
|
+
)
|
79
|
+
end
|
80
|
+
return add_with_z2_one(other, self) if z == 1
|
81
|
+
return add_with_z2_one(self, other) if other.z == 1
|
82
|
+
return add_with_z_ne(self, other)
|
79
83
|
end
|
80
|
-
return add_with_z2_one(other, self) if z == 1
|
81
|
-
return add_with_z2_one(self, other) if other.z == 1
|
82
|
-
add_with_z_ne(self, other)
|
83
|
-
# end
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
return double if self == other
|
86
|
+
raise "Failed to add #{inspect} to #{other.inspect}: No addition rules matched."
|
87
87
|
end
|
88
88
|
alias + add_to_point
|
89
89
|
|
@@ -140,10 +140,10 @@ module ECDSA
|
|
140
140
|
end
|
141
141
|
|
142
142
|
# Return additive inverse of the point.
|
143
|
-
# @return [ECDSA::Ext::
|
143
|
+
# @return [ECDSA::Ext::JacobianPoint]
|
144
144
|
def negate
|
145
145
|
return self if infinity?
|
146
|
-
|
146
|
+
JacobianPoint.new(group, x, field.mod(-y), z)
|
147
147
|
end
|
148
148
|
|
149
149
|
# Return coordinates.
|
data/lib/ecdsa/ext/version.rb
CHANGED