forked from Qortal/qortal
Added Ed25519 signature verify test JavaScript
JS uses tonyg/js-nacl libsodium port. First sig shows disagreement with WhisperSystems-based legacy crypto.
This commit is contained in:
parent
2889d04633
commit
4330782bb7
28
src/test/resources/ed25519-verify-example.html
Normal file
28
src/test/resources/ed25519-verify-example.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="Base58.js"></script>
|
||||||
|
<script src="nacl_factory.js"></script>
|
||||||
|
<script>
|
||||||
|
nacl_factory.instantiate(function (nacl) {
|
||||||
|
var publicKey = Base58.decode('42mzUjJwW2wz6nGmy6a82Nds3WFjhKFkbNZDCKniaEMH');
|
||||||
|
var sig58 = '5SMfs1zSFJmGSG2Jqb7wNXYmkCD3e43kLqLNTjRXVqdQWDqc2Uzbqfg85DcR481qexSfzQ6w39vbMjcFemvy9oQC';
|
||||||
|
var sig = Base58.decode(sig58);
|
||||||
|
var message = Base58.decode('1113B3MNbE13A4ML9Lzjc15aoN2iqvr8wtRb31Grm6Y6pmgZLQjv2EwG2jC5wtGSw8ycmBuhNibMxpeAMhx1zhWTiHzSKhJiUKCe8SXTHLEM7FWNtJVGuoYN5gs3jGy1GEdP4gMDUb5iy9op6ZdfPmR6VjGuN8d15mbmBuVMUYG8FdbbccxbuXZm8mbEg3rethkSysCDju');
|
||||||
|
|
||||||
|
var validSig = nacl.crypto_sign_verify_detached(sig, message, publicKey);
|
||||||
|
console.log("sig " + sig58 + ": " + validSig);
|
||||||
|
|
||||||
|
publicKey = Base58.decode('GNVDeUZEfUWjTybNR7LSoX8XHmHkSNoUMaEYdyvC5JPN');
|
||||||
|
sig58 = '4fnMtFbdv55qJyZLVof5U8RkHF7D1iEJfHEPArAoJ85kiPKAesq7h4GFR6BR2bRZJwpAZLXtumppyzevafrKRNMJ';
|
||||||
|
sig = Base58.decode(sig58);
|
||||||
|
message = Base58.decode('1113B3MNazgGV5aDMwkz6m6Yzos5aRiQtB8czRidu6zdHAYR5emV1Vc1TgSWWHMDNF53xhsDg7ZaMmcah9cZ78gm2cgFFJaZs8scRJseQ3LpY7Au1cv1fQQuCoQK9R5fKb4kMN8uBT2Fy6EpF2JZemJTKbKw44C6VgKsFXXoQBYqUWDCRw9jUn2fiU8Evn84XsL8S1V3eP')
|
||||||
|
|
||||||
|
validSig = nacl.crypto_sign_verify_detached(sig, message, publicKey);
|
||||||
|
console.log("sig " + sig58 + ": " + validSig);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user