Closed tuaris closed 9 years ago
Acknowledged, I'm going to investigate it soon.
Found the issue on https://github.com/BitcoinPHP/BitcoinECDSA.php/blob/master/src/BitcoinPHP/BitcoinECDSA/BitcoinECDSA.php#L1203
$R = bin2hex(substr($signature, 1, 64));
$S = bin2hex(substr($signature, 65, 64));
Should be:
$R = bin2hex(substr($signature, 1, 32));
$S = bin2hex(substr($signature, 33, 64));
One last error on https://github.com/BitcoinPHP/BitcoinECDSA.php/blob/master/src/BitcoinPHP/BitcoinECDSA/BitcoinECDSA.php#L558
if(true == $compressed)
{
return '04' . $pubKey['x'] . $pubKey['y'];
}
Should be:
if(true != $compressed)
{
return '04' . $pubKey['x'] . $pubKey['y'];
}
After those two corrections, everything appears to be working correctly. Pull request is here: #22
My issue is best explained by examples.
It works if I do it this way:
Result:
If I do this:
I get this:
Okay, so I add to the above:
Fails.
What am I doing wrong?