-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
https://github.com/jtobey/javascript-bignum/blob/master/lib/leemonBigInt.js#L903
I've been trying to implement Pollard's Rho algorithm as part of a demonstration of ElGamal. While testing it, I determined that the GCD function sometimes doesn't return the expected results. For example:
GCD([23018,1,0],[17454,0,0])
[2, 0, 0]
GCD([17454,0,0],[23018,1,0])
[14, 0, 0]
According to http://cacr.uwaterloo.ca/hac/about/chap14.pdf, Lehmer's gcd algorithm imposes x >= y as a condition. Since the condition is not documented in the code, I'm not sure if there are other problems with it.
If not, the condition should probably be documented for GCD_. Perhaps GCD should be changed to pass the larger of x and y as the first parameter of the GCD_ call.
Metadata
Metadata
Assignees
Labels
No labels