Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

mceliece-js

cyph4BSD-2-Clausedeprecated1.0.5TypeScript support: included

Renamed to "mceliece".

JavaScript wrapper for an asm.js build of McEliece

cryptography, post-quantum, mceliece, asm.js

readme

mceliece.js

Overview

The McEliece post-quantum asymmetric cipher compiled to pure JavaScript using Emscripten. The specific implementation in use is INRIA's HyMES. A simple wrapper is provided to make McEliece easy to use in web applications.

The parameters are configured to slightly above 128-bit strength.

Example Usage

const keyPair /*: {privateKey: Uint8Array; publicKey: Uint8Array} */ =
    mceliece.keyPair()
;

const plaintext /*: Uint8Array */ =
    new Uint8Array([104, 101, 108, 108, 111, 0]) // "hello"
;

const encrypted /*: Uint8Array */ =
    mceliece.encrypt(plaintext, keyPair.publicKey)
;

const decrypted /*: Uint8Array */ =
    mceliece.decrypt(encrypted, keyPair.privateKey) // same as plaintext
;

Note: McEliece generally shouldn't be used to directly encrypt your data; in most cases, you'll want to pair it with a symmetric cipher and use it to encrypt symmetric keys.