-
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
xero harrison edited this page Mar 29, 2026
·
21 revisions
██ ▐█████ ██ ▐█▌ ▄█▌ ███▌ ▀███████▀▄██▌ ▐█▌ ███▌ ██▌ ▓▓
▐█▌ ▐█▌ ▓█ ▐█▌ ▓██ ▐█▌██ ▐█▌ ███ ██▌ ▐█▌██ ▓██ ██
██▌ ░███ ▐█▌ ██ ▀▀ ██ ▐█▌ ██ ▐██▌ █▓ ▓█ ▐█▌ ▐███▌ █▓
██ ██ ▐█▌ █▓ ▐██ ▐█▌ █▓ ██ ▐██▄▄ ▐█▌ ▐█▌ ██ ▐█▌██ ▐█▌
▐█▌ ▐█▌ ██ ▐█▌ ██ ██ ██ ▐█▌ ██▀▀████▌ ██ ██ ██ ▐█▌▐█▌
▐▒▌ ▐▒▌ ▐▒▌ ██ ▒█ ██▀▀▀██▌ ▐▒▌ ▒█ █▓░ ▒█▀▀▀██▌ ▒█ ██▐█
█▓ ▄▄▓█ █▓ ▄▄▓█ ▓▓ ▐▓▌ ▐▓▌ ▐█▌ ▐▒▌ █▓ ▐▓▌ ▐▓█ ▐▓▌ ▐▒▌▐▓▌ ▐███
▓██▀▀ ▓██▀▀ ▓█▓█ ▐█▌ ▐█▌ ▐▓▌ ▓█ ▐█▌ ▐█▓ ▐█▌ ▐▓▌▐█▌ ██▓
▓█ ▀▀ ▐█▌▌▌
Web cryptography built on Serpent-256 paranoia and XChaCha20-Poly1305 elegance.
bun i leviathan-crypto
# or npm
npm install leviathan-cryptoimport { init, SerpentSeal, randomBytes } from 'leviathan-crypto'
await init(['serpent', 'sha2'])
const key = randomBytes(64)
const seal = new SerpentSeal()
const ciphertext = seal.encrypt(key, plaintext)
const decrypted = seal.decrypt(key, ciphertext) // throws on tamper
seal.dispose()For more: streaming, chunking, hashing, key derivation, and both ciphers: see the examples page.
| Document | Description |
|---|---|
| init.md |
init() API, three loading modes, subpath imports, tree-shaking |
| wasm.md | WebAssembly primer in the context of this library |
| examples.md | Code examples for every primitive |
| exports.md | Comprehensive export reference detailing each class, function, and type |
| Module | Description |
|---|---|
| serpent.md | TypeScript API: SerpentSeal, SerpentStream, SerpentStreamPool, SerpentStreamSealer, SerpentStreamOpener, Serpent, SerpentCtr, SerpentCbc
|
| asm_serpent.md | WASM implementation: bitslice S-boxes, key schedule, CTR/CBC modes |
| Module | Description |
|---|---|
| chacha20.md | TypeScript API: ChaCha20, Poly1305, ChaCha20Poly1305, XChaCha20Poly1305
|
| chacha20_pool.md |
XChaCha20Poly1305Pool: parallel worker pool for authenticated encryption |
| asm_chacha.md | WASM implementation: quarter-round, Poly1305 accumulator, HChaCha20 |
| Module | Description |
|---|---|
| sha2.md | TypeScript API: SHA256, SHA512, SHA384, HMAC_SHA256, HMAC_SHA384, HMAC_SHA512, HKDF_SHA256, HKDF_SHA512
|
| asm_sha2.md | WASM implementation: compression functions, HMAC inner/outer padding |
| Module | Description |
|---|---|
| sha3.md | TypeScript API: SHA3_224, SHA3_256, SHA3_384, SHA3_512, SHAKE128, SHAKE256
|
| asm_sha3.md | WASM implementation: Keccak permutation (1600-bit state), sponge construction |
| Module | Description |
|---|---|
| fortuna.md |
Fortuna: CSPRNG with forward secrecy, 32 entropy pools, browser + Node.js collectors |
| Module | Description |
|---|---|
| utils.md | Encoding helpers, constantTimeEqual, wipe, randomBytes, hasSIMD no init() required
|
| types.md | TypeScript interfaces: Hash, KeyedHash, Blockcipher, Streamcipher, AEAD
|
| Module | Description |
|---|---|
| loader.md | WASM binary loading: embedded (base64), streaming (fetch), manual |
| Document | Description |
|---|---|
| architecture.md | Repository structure, architecture diagram, build pipeline, module relationships, buffer layouts, correctness contract, limitations |
| test-suite.md | Test suite structure, vector corpus, gate discipline |
| serpent_reference.md | Serpent algorithm: S-boxes, linear transform, round structure, known attacks |
| wasm.md | WebAssembly primer in the context of this library |
| argon2id.md | Key derivation and password hashing with Argon2id alongside Leviathan primitives |
| branding.md | Project artwork and branding materials |
| Document | Description |
|---|---|
| serpent_simd_bench.md | Serpent-256 SIMD benchmark results: CTR and CBC-decrypt inter-block 4-wide, scalar vs SIMD across V8, SpiderMonkey, and JSC |
| chacha_simd_bench.md | ChaCha20 SIMD benchmark results: 4-wide inter-block parallelism, scalar vs SIMD across V8, SpiderMonkey, and JSC. Includes documented negative result for intra-block approach |
| Primitive | Audit Description |
|---|---|
| serpent_audit.md | Correctness verification, side-channel analysis, cryptanalytic attack paper review |
| chacha_audit.md | XChaCha20-Poly1305 correctness, Poly1305 field arithmetic, HChaCha20 nonce extension |
| sha2_audit.md | SHA-256/512/384 correctness, HMAC and HKDF composition, constant verification |
| sha3_audit.md | Keccak permutation correctness, θ/ρ/π/χ/ι step verification, round constant derivation |
| hmac_audit.md | HMAC-SHA256/512/384 construction, key processing, RFC 4231 vector coverage |
| hkdf_audit.md | HKDF extract-then-expand, info field domain separation, SerpentStream key derivation |
| Name | Link | Code | Docs | Description |
|---|---|---|---|---|
lvthn-web |
▼ | 🛈 | ¶ | Encrypt text or files using Serpent-256-CBC and Argon2id key derivation from a single local html file, with armored output. No server, installation, or network connection required after initial load. |
lvthn-chat |
▼ | 🛈 | ¶ | End-to-end encrypted chat featuring two-party messaging over X25519 key exchange and XChaCha20-Poly1305 message encryption. Relay server functions as a dumb WebSocket pipe never seeing plaintexts. |
lvthn-cli |
▼ | 🛈 | ¶ | File encryption CLI tool supporting both Serpent-256 and XChaCha20-Poly1305 via the --cipher flag. Keyfiles are compatible with both ciphers; the header byte determines decryption automatically. |
- Sign Tools
-
SignatureSuite
- format-byte catalog, hybrid composite encodings, custom suite contract
- Serpent-256 TypeScript | WASM
-
Serpent,SerpentCtr,SerpentCbc,SerpentGenerator
-
- ChaCha20 TypeScript | WASM
-
ChaCha20,Poly1305,ChaCha20Poly1305,XChaCha20Poly1305,ChaCha20Generator
-
- AES TypeScript | WASM
-
AES,AESCbc,AESCtr,AESGCM,AESGCMSIV,AESGenerator
-
- ML-DSA TypeScript | WASM
- pure (FIPS 204):
MlDsa44,MlDsa65,MlDsa87 - pure-mode suites:
MlDsa44Suite,MlDsa65Suite,MlDsa87Suite - prehash suites:
MlDsa44PreHashSuite,MlDsa65PreHashSuite,MlDsa87PreHashSuite
- pure (FIPS 204):
- SLH-DSA TypeScript | WASM
- pure (FIPS 205):
SlhDsa128f,SlhDsa192f,SlhDsa256f - pure-mode suites:
SlhDsa128fSuite,SlhDsa192fSuite,SlhDsa256fSuite - prehash suites:
SlhDsa128fPreHashSuite,SlhDsa192fPreHashSuite,SlhDsa256fPreHashSuite
- pure (FIPS 205):
- Ed25519 TypeScript | WASM
-
Ed25519(pure + Ed25519ph),Ed25519Suite,Ed25519PreHashSuite
-
- ECDSA-P256 TypeScript | WASM
-
EcdsaP256(hedged + RFC 6979),EcdsaP256Suite - DER codec:
ecdsaSignatureToDer,ecdsaSignatureFromDer,encodeEcPrivateKey,decodeEcPrivateKey,pointDecompress
-
- Hybrid composites PQ-only | Classical+PQ
- PQ-only:
MlDsa44SlhDsa128fSuite,MlDsa65SlhDsa192fSuite,MlDsa87SlhDsa256fSuite - Classical+PQ:
MlDsa44Ed25519Suite,MlDsa65Ed25519Suite,MlDsa44EcdsaP256Suite,MlDsa65EcdsaP256Suite
- PQ-only:
- X25519 TypeScript | WASM
-
X25519,KeyAgreementError(RFC 7748)
-
- ML-KEM TypeScript | WASM
-
MlKem512,MlKem768,MlKem1024
-
-
Ratchet (SPQR)
-
KDFChain,ratchetInit,kemRatchetEncap,kemRatchetDecap,RatchetKeypair,SkippedKeyStore
-
- Hashing overview
- SHA-2 TypeScript | WASM
-
SHA256,SHA384,SHA512,SHA224,SHA512_224,SHA512_256 -
HMAC_SHA256,HMAC_SHA384,HMAC_SHA512,HKDF_SHA256,HKDF_SHA512
-
- SHA-3 TypeScript | WASM
-
SHA3_224,SHA3_256,SHA3_384,SHA3_512,SHAKE128,SHAKE256
-
- BLAKE3 TypeScript | WASM
-
BLAKE3,BLAKE3Stream,BLAKE3KeyedHash,BLAKE3KeyedHashStream -
BLAKE3DeriveKey,BLAKE3DeriveKeyStream,BLAKE3OutputReader,BLAKE3Hash
-
-
KMAC
-
CSHAKE128,CSHAKE256,KMAC128,KMAC256,KMACXOF128,KMACXOF256
-
-
Merkle
-
MerkleVerifier,MerkleLog -
SignedLog,Sha256Tree,Blake3Tree,MemoryStorage
-
-
Fortuna CSPRNG
-
Fortuna,SerpentGenerator,ChaCha20Generator,AESGenerator,SHA256Hash,SHA3_256Hash,BLAKE3Hash
-
- Utils TypeScript | WASM
-
constantTimeEqual,randomBytes,wipe, encoding helpers
-
-
TypeScript interfaces
-
Hash,KeyedHash,Blockcipher,Streamcipher,AEAD,Generator,HashFn
-