ed25519-wasm-vn
v1.0.0
Published
Ed25519 for WebAssembly
Maintainers
Readme
ed25519-wasm-vn
Browser
import init, { getPublicKey, sign, verify } from 'ed25519-wasm-vn/web';
await init();
// Generate a random string that length is 32 bytes
// https://www.avast.com/random-password-generator#pc
const _private_key = new TextEncoder().encode('h6wned9SXw2wnw8Q8Hjp1YWeOVhsWzQ4');
// Get KeyPair from Private Key
const _public_key = getPublicKey(_private_key)
const message = new TextEncoder().encode(`click the letter that the command starts with, and then click the command name`)
// sign data
const signature = sign(_private_key, message)
console.log("signature: " + new TextDecoder().decode(signature).toString());
// verify signature
const isTrust = verify(_public_key, message, signature)
console.log("Result: " + isTrust);Benchmark
| (index) | Task name | Latency avg (ns) | Latency med (ns) | Throughput avg (ops/s) | Throughput med (ops/s) | Samples | |---------|-----------|------------------|------------------|------------------------|------------------------|---------| | 0 | 'sign' | '215517 ± 1.86%' | '200000 ± 0.00' | '5140 ± 2.41%' | '5000 ± 0' | 928 | | 1 | 'verify' | '338748 ± 2.16%' | '300000 ± 0.00' | '3127 ± 1.92%' | '3333 ± 0' | 591 |
