diff --git a/src/Rpc/KeyPair/ed25519.php b/src/Rpc/KeyPair/ed25519.php index f0551c4..4587030 100644 --- a/src/Rpc/KeyPair/ed25519.php +++ b/src/Rpc/KeyPair/ed25519.php @@ -45,6 +45,7 @@ public function __construct (string $secretKey) */ public function sign (string $msg): string { + $msg = (substr($msg, 0, 2) == '0x') ? hex2bin(substr($msg, 2)) : $msg; return sodium_bin2hex(sodium_crypto_sign_detached($msg, sodium_hex2bin($this->sk))); } @@ -80,4 +81,4 @@ public function verify (string $signature, string $msg): bool { return sodium_crypto_sign_verify_detached(sodium_hex2bin($signature), $msg, sodium_hex2bin($this->pk)); } -} \ No newline at end of file +}