No description
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-25 12:58:23 +02:00
.gitignore minor improvements 2026-01-17 16:25:55 +01:00
build.ts build.ts changed 2026-01-17 15:31:08 +01:00
index.ts minor improvements 2026-01-17 16:25:55 +01:00
package.json readme change 2026-04-26 13:13:48 +02:00
README.md fixed readme 2026-07-25 12:58:23 +02:00
utils.ts some more style improvements and error messages 2026-01-17 13:12:19 +01:00

kyber-mini

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 kyber-mini

or

npm install kyber-mini

Audit

This library has not been audited by a third party.