@li0ard/des
DES cipher implementation in pure TypeScript
docs
# from NPM
npm i @li0ard/des
# from JSR
bunx jsr i @li0ard/des
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 [ ... ]