Skip to content

Commit

Permalink
fix: decodepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
recanman committed Jun 5, 2024
1 parent b6f49d2 commit f732277
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Ed25519.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ public function decodepoint(string $encoded): Point
// Convert to little-endian
$encoded = strrev(hex2bin($encoded));

$y = $this->decodeint($encoded);
$y = $this->decodeint(substr($encoded, 0, 32));
$x = $this->xrecover($y);

if ($x->binaryAnd(new BigInteger("1"))->cmp($this->bit($encoded, $this->b->sub(1))) != 0) {
if ($x->binaryAnd(new BigInteger("1"))->toNumber() != $this->bit($encoded, new BigInteger("255"))) {
$x = $this->q->sub($x);
}

Expand Down

0 comments on commit f732277

Please sign in to comment.