Encryption plugin for Emacs providing casual privacy through multiple cipher implementations.
- Three cipher implementations: Shift, XOR, and Caesar
- Full buffer or region-based encryption/decryption
- Password persistence with obfuscation
- Cipher preference persistence
- Smart toggle detection (auto-detects encrypted content)
(straight-use-package
'(bytelocker :type git :host github :repo "abaj8494/bytelocker.el"))
(require 'bytelocker)
(bytelocker-setup)(use-package bytelocker
:straight (:type git :host github :repo "abaj8494/bytelocker.el")
:config
(bytelocker-setup))Clone this repository and add to your load path:
(add-to-list 'load-path "/path/to/bytelocker.el")
(require 'bytelocker)
(bytelocker-setup)(use-package bytelocker
:load-path "/path/to/bytelocker.el"
:config
(bytelocker-setup))All commands are available via the C-c e m prefix:
| Key | Command | Description |
|---|---|---|
C-c e m t |
bytelocker-toggle |
Smart toggle encryption/decryption |
C-c e m e |
bytelocker-encrypt |
Encrypt buffer or region |
C-c e m d |
bytelocker-decrypt |
Decrypt buffer or region |
C-c e m c |
bytelocker-change-cipher |
Change encryption cipher |
C-c e m p |
bytelocker-clear-password |
Clear stored password |
C-c e m x |
bytelocker-clear-cipher |
Reset cipher preference |
- Open a file in Emacs
- Press
C-c e m tto toggle encryption (orC-c e m eto explicitly encrypt) - Select a cipher (first time only - choice is saved)
- Enter a password (saved for session)
- Save the file
To decrypt:
- Open an encrypted file
- Press
C-c e m t(auto-detects encryption) orC-c e m d - Password and cipher are loaded from saved preferences
Select a region before running any command to encrypt/decrypt only the selected text.
(setq bytelocker-default-cipher 'xor) ; Default: 'shift
(setq bytelocker-setup-keymaps nil) ; Disable default keybindings
(setq bytelocker-data-directory "~/.config/bytelocker") ; Custom data directoryBitwise rotation cipher. Each byte is rotated left/right by an amount derived from the password.
XOR-based encryption with rotation. Includes protection against null-input password leakage.
Character shifting cipher with XOR preprocessing. Provides null-byte handling protection.
Encrypted content follows this format:
---BYTELOCKER-ENCRYPTED-FILE---
<base64-encoded-encrypted-data>
---END-BYTELOCKER-ENCRYPTED-FILE---
This plugin is designed for casual privacy, not cryptographic security. The ciphers are educational/convenience implementations and should not be used for protecting highly sensitive data. Passwords are stored with basic obfuscation (not encryption).
Run tests:
make testOr in Emacs:
M-x ert RET t RET
Generate coverage report (requires undercover.el):
# Text report to stdout
make coverage
# LCOV format (for tools like genhtml, codecov)
make coverage-lcovTo generate an HTML coverage report:
make coverage-lcov
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.htmlMIT
