ecdsa_ext 0.4.0 → 0.4.1

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: 84f032825c120367ced4c69a3faf2f25c519b0591a6fe2e6a9ebe21e1456a66b
4
- data.tar.gz: af328ff04a086fabaf93652cab94400c95a1dfba85daff6667defca0c112b2a1
3
+ metadata.gz: 125f4595851c77d460e1edfa38919c125aa3c06fc469135fc1ba5fe16191a760
4
+ data.tar.gz: 609d0345ac21dde9f6274db647b7fac1c4a3c9a45cc7fe7a9b9864605cf1b01d
5
5
  SHA512:
6
- metadata.gz: c1c83beba1a26a89ba958f0b1f3f75ea48ad4777f252c1430294997cf44385c205559876354fe62d728f714fc162606af4975535c813a18595623d8ed6944d09
7
- data.tar.gz: e32b28574ec1c21cc336039e9a66a780784a7a5d3ea2a1fa20796799c2077f24b6db0dcb8853d0b7067bba4b6b41d7196214df10b7175037ab118828a74934ba
6
+ metadata.gz: e38986f4f0ecd76a1ab4ac495e1e1d745bbdb0ccb66d81a672e3d8331b8a47b5d4fc726ea716d2f50db6ae91cbe09ed89a01e5bc612fe7467b5485e2adad7326
7
+ data.tar.gz: 15d1f967986650ce026dc8e6bec695035d2002f69238f96db1324b4ffe736d1adbe653ee1d3c90f4bd67e80a69fdf47d65b6f39f2f4c9fcb3e103dce542c1fab
@@ -28,14 +28,25 @@ module ECDSA
28
28
  return self if other.y.zero? || other.z.zero?
29
29
 
30
30
  unless x == other.x
31
- if z == other.z
32
- return(
31
+ new_point =
32
+ if z == other.z
33
33
  z == 1 ? add_with_z_one(self, other) : add_with_z_eq(self, other)
34
+ elsif z == 1
35
+ add_with_z2_one(other, self)
36
+ elsif other.z == 1
37
+ add_with_z2_one(self, other)
38
+ else
39
+ add_with_z_ne(self, other)
40
+ end
41
+ return(
42
+ (
43
+ if new_point.y.zero? || new_point.z.zero?
44
+ JacobianPoint.infinity_point(group)
45
+ else
46
+ new_point
47
+ end
34
48
  )
35
- end
36
- return add_with_z2_one(other, self) if z == 1
37
- return add_with_z2_one(self, other) if other.z == 1
38
- return add_with_z_ne(self, other)
49
+ )
39
50
  end
40
51
 
41
52
  return double if self == other
@@ -25,12 +25,18 @@ module ECDSA
25
25
  end
26
26
 
27
27
  unless x == other.x
28
+ new_point =
29
+ if group.param_a == field.mod(-3)
30
+ addition_negative3(self, other)
31
+ else
32
+ addition_any(self, other)
33
+ end
28
34
  return(
29
35
  (
30
- if group.param_a == field.mod(-3)
31
- addition_negative3(self, other)
36
+ if new_point.y.zero? || new_point.z.zero?
37
+ JacobianPoint.infinity_point(group)
32
38
  else
33
- addition_any(self, other)
39
+ new_point
34
40
  end
35
41
  )
36
42
  )
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ECDSA
4
4
  module Ext
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecdsa_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ecdsa