hqc
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

hqc

Overview

The HQC post-quantum asymmetric cypher compiled to WebAssembly using Emscripten. A simple JavaScript wrapper is provided to make HQC easy to use in web applications.

The default parameter set is HQC-RMRS-256 (roughly 256-bit strength).

Example Usage

import {hqc} from 'hqc';

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

const {cyphertext, secret} /*: {cyphertext: Uint8Array; secret: Uint8Array} */ =
	await hqc.encrypt(keyPair.publicKey)
;

const decrypted /*: Uint8Array */ =
	await hqc.decrypt(cyphertext, keyPair.privateKey) // same as secret
;

console.log(keyPair);
console.log(secret);
console.log(cyphertext);
console.log(decrypted);

Package Sidebar

Install

npm i hqc

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

238 kB

Total Files

9

Last publish

Collaborators

  • cyphinc