@li0ard/des
DES cipher implementation in pure TypeScript
docs
# from NPM
npm i @li0ard/des
# from JSR
bunx jsr i @li0ard/des- Classic DES
- 3DES-EDE
- Electronic Codebook (ECB)
- Cipher Block Chaining (CBC)
- Cipher Feedback (CFB)
- Counter (CTR)
- Output Feedback (OFB)
- Retail MAC (ISO/IEC 9797-1 Algorithm 3)
- Provides simple and modern API
- Most of the APIs are strictly typed
- Fully complies with FIPS 46-3 standard
- Supports Bun, Node.js, Deno, Browsers
import { decryptECB, encryptECB } from "@li0ard/des";
const key = Buffer.from("1122334455667788", "hex");
const plaintext = Buffer.from("11223344556677881122334455667788", "hex");
const encrypted = encryptECB(key, plaintext);
console.log(encrypted); // Uint8Array [ ... ]
const decrypted = decryptECB(key, encrypted);
console.log(decrypted); // Uint8Array [ ... ]import { decryptECB, encryptECB } from "@li0ard/des";
const key = Buffer.from("1122334455667788...1122334455667788", "hex");
const plaintext = Buffer.from("11223344556677881122334455667788", "hex");
const encrypted = encryptECB(key, plaintext, true);
console.log(encrypted); // Uint8Array [ ... ]
const decrypted = decryptECB(key, encrypted, true);
console.log(decrypted); // Uint8Array [ ... ]