fix IEEE length calculations

secp521r1 has length of 521 so we want 66 to cover that last extra bit
- not 65
This commit is contained in:
terrafrost 2024-08-02 09:04:47 -05:00
parent 2276cf51c0
commit 45b98d8cb3

View File

@ -62,7 +62,7 @@ abstract class IEEE
{
$r = $r->toBytes();
$s = $s->toBytes();
$length >>= 3;
$length = (int) ceil($length / 8);
return str_pad($r, $length, "\0", STR_PAD_LEFT) . str_pad($s, $length, "\0", STR_PAD_LEFT);
}
}