A Swift command-line tool that provides secure encryption and decryption capabilities using modern cryptographic algorithms. Built with Apple's CryptoKit framework for high-performance, secure cryptographic operations.
- ChaCha20-Poly1305 Encryption: Industry-standard authenticated encryption algorithm
- Command-Line Interface: Easy-to-use CLI for encryption and decryption operations
- Swift Package Manager: Modern Swift package with comprehensive testing
- Secure Key Handling: Uses SHA-256 hashing for key derivation
- Base64 Encoding: Human-readable output format for encrypted data
- macOS 12.0 or later
- Swift 6.0 or later
- Xcode 14.0 or later (for development)
Download the latest pre-built binary from GitHub Releases:
# Download and install (replace VERSION with the latest version)
curl -L https://github.com/TogglesPlatform/ToggleCipher/releases/download/VERSION/ToggleCipher -o /usr/local/bin/ToggleCipher
chmod +x /usr/local/bin/ToggleGen-
Clone the repository:
git clone https://github.com/TogglesPlatform/ToggleCipher.git cd ToggleCipher -
Build the executable:
swift build -c release
-
The executable will be available at
.build/release/ToggleCipher
ToggleCipher provides two main commands: encrypt and decrypt.
ToggleCipher encrypt --algorithm chaChaPoly --key "your-secret-key" --value "data to encrypt"Example:
ToggleCipher encrypt --algorithm chaChaPoly --key "mySecretKey123" --value "Hello, World"Output:
Plaintext value: "Hello, World"
Encrypted value: "9bnthawCQI+H5gRFM+4i7ng491R7ZnQ4Iqd5nCuKZ/hAYf6AzDV/5w=="
ToggleCipher decrypt --algorithm chaChaPoly --key "your-secret-key" --value "encrypted-data"Example:
ToggleCipher decrypt --algorithm chaChaPoly --key "mySecretKey123" --value "base64-encoded-encrypted-data"Output:
Encrypted value: "9bnthawCQI+H5gRFM+4i7ng491R7ZnQ4Iqd5nCuKZ/hAYf6AzDV/5w=="
Decrypted value: "Hello, World"
| Option | Description | Required |
|---|---|---|
--algorithm |
The encryption algorithm to use (currently supports: chaChaPoly) |
Yes |
--key |
The secret key used for encryption/decryption | Yes |
--value |
The data to encrypt or decrypt | Yes |
Currently, ToggleCipher supports the following encryption algorithms:
- ChaCha20-Poly1305 (
chaChaPoly): A high-speed, authenticated encryption algorithm that provides both confidentiality and authenticity
- Key Management: Ensure your encryption keys are stored securely and never hard-coded in your applications
- Key Derivation: Keys are processed through SHA-256 hashing before use, providing consistent key lengths
- Authenticated Encryption: ChaCha20-Poly1305 provides both encryption and authentication, protecting against tampering
- Secure Random: The encryption process uses cryptographically secure random number generation
This project is licensed under the terms specified in the LICENSE file.
Contributions are welcome! Please feel free to submit a Pull Request.
For more information about the ChaCha20-Poly1305 algorithm, see RFC 8439.