Provides Node.js implementations of MySQL's AES_ENCRYPT and AES_DECRYPT functions, enabling encryption and decryption compatible with MySQL's block cipher mode. Version 0.1.0, last updated in 2016, is the only stable release. It is a lightweight library with no external dependencies, supporting ESM and CommonJS. Key differentiator: it mirrors MySQL's AES behavior exactly, using AES-128-ECB with PKCS7 padding and a specific key derivation, making it suitable for applications that need to encrypt/decrypt data consistently with MySQL. However, it is unmaintained and uses a weak cipher mode (ECB) that should not be used for new projects; use a more secure alternative.
npm install mysql-aesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates encryption and decryption using AES.encrypt and AES.decrypt, matching MySQL's AES_ENCRYPT and AES_DECRYPT.
Use a library that supports AES-GCM or AES-CBC with a random IV, such as Node.js built-in crypto module.
If using MySQL 5.7+ with block_encryption_mode='aes-256-cbc', this library will not match MySQL's behavior. Use mysql2 or @mysql/xdevapi for proper encryption.
Migrate to an actively maintained library like 'crypto' (Node.js built-in) or 'aes-js'.
Use: import AES from 'mysql-aes' then AES.encrypt(...)
Ensure ciphertext is hexadecimal (as returned by AES.encrypt) and use the exact same key.
Always pass key as a string: AES.encrypt(plaintext, String(key))
No dependency data recorded yet.