Created
June 16, 2014 21:38
-
-
Save magoon/39c9d2899ea53702b623 to your computer and use it in GitHub Desktop.
Simple encrypt/decrypt
This file contains 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
# | |
# Add the following to your .bash_profile | |
# | |
# Example: If you run "enc secretfile secretfile.encrypted" | |
# it'll ask you for a password. Then you, or a friend, can | |
# reverse it with "dec secretfile.encrypted secretfile" | |
# | |
# -andymagoon@gmail.com 2014-06-16 | |
alias enc=encryptfunc | |
alias dec=decryptfunc | |
function encryptfunc() { | |
if [ -z $1 ] | |
then | |
echo "usage: infile outfile" | |
return | |
fi | |
openssl enc -aes-256-cbc -salt -in $1 -out $2 | |
} | |
function decryptfunc() { | |
if [ -z $1 ] | |
then | |
echo "usage: infile outfile" | |
return | |
fi | |
openssl enc -d -aes-256-cbc -in $1 -out $2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment