Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit b136697

Browse files
committed
Fixed a BigDecimal incompatibility (closes #3).
1 parent 99cd7c7 commit b136697

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rsa/math.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def self.prime?(n)
9999
# @see http://en.wikipedia.org/wiki/Coprime
100100
# @see http://mathworld.wolfram.com/RelativelyPrime.html
101101
def self.coprime?(a, b)
102-
gcd(a, b).equal?(1)
102+
egcd = self.egcd(a, b)
103+
(a*egcd[0] + b*egcd[1]).eql?(1)
103104
end
104105

105106
##

0 commit comments

Comments
 (0)