Skip to content

Instantly share code, notes, and snippets.

@magoon
Created June 16, 2014 21:38
Show Gist options
  • Save magoon/39c9d2899ea53702b623 to your computer and use it in GitHub Desktop.
Save magoon/39c9d2899ea53702b623 to your computer and use it in GitHub Desktop.
Simple encrypt/decrypt
#
# 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