Skip to content

Commit

Permalink
Implemented Keypair::getPublicKeyChecksum
Browse files Browse the repository at this point in the history
  • Loading branch information
zulucrypto committed Aug 12, 2018
1 parent e2ed0dc commit eb22c4a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Keypair.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ public function getHint()
return substr($this->publicKey, -4);
}

/**
* Returns the raw bytes of the checksum for the public key
*
* @return string
*/
public function getPublicKeyChecksum()
{
$checksumBytes = substr($this->getPublicKeyBytes(), -2);

$unpacked = unpack('v', $checksumBytes);

return array_shift($unpacked);
}

/**
* Returns the base-32 encoded private key (S...)
* @return string
Expand Down

0 comments on commit eb22c4a

Please sign in to comment.