Skip to content

Instantly share code, notes, and snippets.

@romaad
Created March 18, 2017 16:01
Show Gist options
  • Save romaad/3836dd18dd21f4e856d265a542cf03c0 to your computer and use it in GitHub Desktop.
Save romaad/3836dd18dd21f4e856d265a542cf03c0 to your computer and use it in GitHub Desktop.
#!/bin/bash
#program that decrypts and encrypts a file using des3
#encrypts a file and save it
if [ "$1" = "-e" ]; then
openssl des3 < $2 > $2.des3
fi
#encrypts a file and erase the original
if [ "$1" = "-ee" ]; then
openssl des3 < $2 > $2.des3
rm $2
fi
#decrypt file and show it
if [ "$1" = "-ds" ]; then
openssl des3 -d < $2.des3
echo "" #echo new line
fi
#decrypt file and write it
if [ "$1" = "-dw" ]; then
openssl des3 -d < $2.des3 > $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment