Created
August 12, 2024 06:27
-
-
Save FATESAIKOU/eec7cec784717134558e6dc1aa8f5f7b to your computer and use it in GitHub Desktop.
Encrypt and Decrypt with openssl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PASSWORD=$1 | |
# encryption | |
echo "Hello, world!" | openssl enc -aes-256-cbc -pbkdf2 -iter 10000 -a -salt -pass pass:"$PASSWORD" > helloWorld.crypted | |
# decryption | |
cat helloWorld.crypted | openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -a -pass pass:"$PASSWORD" # Output "Hello, world!" here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment