Package Exports
- ecdsa-wasm
- ecdsa-wasm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ecdsa-wasm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ECSSA/secp256k1 + SHA-256
Abstract
This is a wasm version of mcl/ecdsa.h
News
serialize() supports the format defined at BitCoin
for Node.js
npm testhow to use
const ecdsa = require('ecdsa-wasm')
// create secret key
const sec = new ecdsa.SecretKey()
// initialize sec
sec.setByCSPRNG()
// get public key
const pub = sec.getPublicKey()
// make signature
const sig = sec.sign("abc")
// verify signatpure by pub
> pub.verify(sig, "abc")
true
> pub.verify(sig, "abcd")
false
// create precomputed public key(faster than pub)
const ppub = new ecdsa.PrecomputedPublicKey()
// initialize ppub
ppub.init(pub)
// verify signature by ppub
> ppub.verify(sig, "abc")
true
> ppub.verify(sig, "abcd")
false
// destroy ppub if unnecessary
ppub.destroy()serialization
SecretKey.serialize()return 32-bytes Uint8Array as big-endianPublicKey.serialize()return 65-bytes Uint8Array as 0x04 +x+yPublicKey.serializeCompressed()return 33-bytes Uint8Array as 0x02 (y is even) or 0x03 (y is odd) +xSignature.serialize()return DER-formatSecretKey.deserialize(a)PublicKey.deserialize(a)Signature.deserialize(a)- take
Uint8Arrayofaand constract the object
- take
how to build ecdsa_c.js
Install emscripten.
git clone --recurse-submodules git@github.com:herumi/ecdsa-wasm
cd ecdsa-wasm
make -C src wasmLicense
modified new BSD License http://opensource.org/licenses/BSD-3-Clause
Author
光成滋生 MITSUNARI Shigeo(herumi@nifty.com)