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

1.0.7 • Public • Published

kyber-crystals

Overview

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

The default parameter set is Kyber-1024 (roughly 256-bit strength).

Example Usage

import {kyber} from 'kyber-crystals';

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

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

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

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

Package Sidebar

Install

npm i kyber-crystals

Weekly Downloads

6

Version

1.0.7

License

MIT

Unpacked Size

92.6 kB

Total Files

9

Last publish

Collaborators

  • cyphinc