Summary
Add an XOR encryption/decryption mode where one file is XORed with another (key file), modifying only the target file.
Background
The current XOR swap modifies BOTH files (content exchange). But XOR has another use case: simple symmetric encryption.
Proposed Feature
# Encrypt: XOR target with key, overwrites target
xmv secret.txt keyfile.bin --xor-with
# Decrypt: Same operation (XOR is symmetric)
xmv secret.txt.enc keyfile.bin --xor-with
How It Works
plaintext XOR key = ciphertext
ciphertext XOR key = plaintext
Only the first file is modified. The key file remains unchanged.
Use Cases
- Simple obfuscation: Hide file contents with a key
- One-time pad: If key is random and >= file size, theoretically unbreakable
- Educational: Demonstrate XOR encryption concepts
- CTF challenges: Create/solve XOR-based puzzles
Implementation Notes
- Only first file is modified
- Key file must be readable but isn't changed
- If key is shorter than target, could repeat (less secure) or error
--verify should still work (hash before/after)
CLI Options
--xor-with # XOR first file with second (key)
--xor-repeat # Repeat key if shorter than target (less secure)
--xor-truncate # Only XOR up to key length, leave rest unchanged
Security Warning
This is NOT a secure encryption method for sensitive data. It's useful for:
- Obfuscation
- Educational purposes
- One-time pad (if key is truly random and used once)
For real encryption, use proper tools (GPG, age, etc.).
Related
- Core XOR swap functionality
- Could integrate with
--dry-run to preview operation
Summary
Add an XOR encryption/decryption mode where one file is XORed with another (key file), modifying only the target file.
Background
The current XOR swap modifies BOTH files (content exchange). But XOR has another use case: simple symmetric encryption.
Proposed Feature
How It Works
Only the first file is modified. The key file remains unchanged.
Use Cases
Implementation Notes
--verifyshould still work (hash before/after)CLI Options
Security Warning
This is NOT a secure encryption method for sensitive data. It's useful for:
For real encryption, use proper tools (GPG, age, etc.).
Related
--dry-runto preview operation