ID: 15835
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Feedback
+Status: Open
Bug Type: *Math Functions
Operating System: Linux - Red Hat 7.2
PHP Version: 4.1.2
New Comment:
gmp_invert() should return the multiplicative inverse (if exist) of a
number, module something.
It's the extended Euclidean algorithm. I wrote this code and I can give
you. I think there is something wrong to gmp_invert.
Previous Comments:
------------------------------------------------------------------------
[2002-03-03 06:42:28] [EMAIL PROTECTED]
I can't get gmp_invert() return anything other than false, but that
might be because I have no idea what gmp_invert() does :)
Can you supply some (human understandable) data that does work?
------------------------------------------------------------------------
[2002-03-02 14:20:49] [EMAIL PROTECTED]
Example:
$x =
gmp_init("0x00d2d025ec7e1dbb6d778a52394c988594c57b47d7327a3e676d3a5ca7a5af87c4153c80994cf781f6a9d4a2f0e66d04baffb0059853a8937a895f6d17e76950e1");
// mod
$y = gmp_init("6211846575289879599"); // value
$w = gmp_invert($y,$x);
The $w value should be :
6673516182899846998314488146047624198500176381239637064622226136275029334435034698239463153441869117173460635003602664197747901516108936488872273669129832
------------------------------------------------------------------------
[2002-03-02 13:29:43] [EMAIL PROTECTED]
Please provide a short reproducing script with values that you are
using and expected output.
Sean
------------------------------------------------------------------------
[2002-03-02 11:44:47] [EMAIL PROTECTED]
The function resource gmp_invert() doesn't work right. It always return
zero.
I implemented the extended Euclides algoritm that do exactly the same
that this function and, it returned me the right value.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15835&edit=1