mceliece
v5.0.4
Published
JavaScript wrapper for a WebAssembly build of McEliece
Downloads
33
Maintainers
Readme
mceliece
Overview
The Classic McEliece post-quantum asymmetric cypher compiled to WebAssembly using Emscripten. A simple JavaScript wrapper is provided to make McEliece easy to use in web applications.
The default parameter set is mceliece8192128 (roughly 256-bit strength).
Example Usage
import {mceliece} from 'mceliece';
const keyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
await mceliece.keyPair()
;
const {cyphertext, secret} /*: {cyphertext: Uint8Array; secret: Uint8Array} */ =
await mceliece.encrypt(keyPair.publicKey)
;
const decrypted /*: Uint8Array */ =
await mceliece.decrypt(cyphertext, keyPair.privateKey) // same as secret
;
console.log(keyPair);
console.log(secret);
console.log(cyphertext);
console.log(decrypted);
Changelog
Breaking changes in major versions:
5.0.0:
- Switched from McBits to Classic McEliece. For backwards compatibility with previous versions of this package, use mceliece-legacy.
4.0.0:
Cyphertext generated by mceliece 4.x is incompatible with that of mceliece 3.x, and vice versa:
Upgraded to McBits 2.0 and switched symmetric cypher from Salsa20 to ChaCha20.
Fixed a bug that sometimes caused invalid output.
Decreased maximum plaintext size from 403 to 106 (for consistency with ntru, as well as smaller output).
3.0.0:
- As part of upgrading from asm.js to WebAssembly (with asm.js included as a fallback), the API is fully asynchronous.
2.0.0:
Switched to McBits from HyMES.
Removed some undocumented functions as part of minor API cleanup.
Credits
Thanks to Shane Curran for donating the npm package name!