kyber-mini
v1.0.3
Published
A lightweight kyber PKE and KEM library
Maintainers
Readme
kyber
A minimalistic, high-performance TypeScript/JavaScript implementation of the Kyber KEM and PKE algorithms (standard specified by FIPS203).
Performance
Benchmarks indicate performance on par with noble/post-quantum in Node.js, and approximately 2x faster when running with Bun.
Usage
kyber KEM usage example using ML_KEM1024:
import { kyberKEM1024 } from "kyber-mini";
// generates a pair of private and public keys.
const keys = kyberKEM1024.keyGen();
// creates a shared key and creates a ciphertext from which the recipient can recreate the shared key
const encapsulatedKeys = kyberKEM1024.encapsulate(keys.publicKey);
// recreates the shared key from ciphercode
const sharedKey = kyberKEM1024.decapsulate(encapsulatedKeys.ciphertext, keys.privateKey);kyber PKE usage example using ML_PKE1024:
import { kyberPKE1024 } from "kyber-mini";
// generates kyber_pke keys
const keys = kyberPKE1024.keyGen();
const message = new Uint8Array(32);
// set a message
// encrypts the message with a public key
const ciphertext = kyberPKE1024.encrypt(message, keys.publicKey);
// decrypts the message with a private key
const decryptedMessage = kyberPKE1024.decrypt(ciphertext, keys.privateKey);Instalation
bun install or
npm install kyber-miniAudit
This library has not been audited by a third party.
