Advertisement
howtophil

Encypt then encode to codegroup to write down

Jan 9th, 2017
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.05 KB | None | 0 0
  1. #!/bin/bash
  2. cmdopt=$1
  3.  
  4. if [ -z $cmdopt ]; then
  5.     echo "Please specify -e to encrypt or -d to decrypt"
  6. fi
  7.  
  8. if [[ $cmdopt == "-e" ]]; then
  9.     echo "#---------------------------------------------------"
  10.     echo "# You'll be asked for your encryption key"
  11.     echo "# After you enter that key twice:"
  12.     echo "# Type the text you'd like to encrypt"
  13.     echo "# and hit ctrl-d when done."
  14.     echo "# Then you'll get the codegroup encoded form"
  15.     echo "# of your encrypted data."
  16.     echo "# Which you can write down wherever."
  17.     echo "#---------------------------------------------------"
  18.     ccrypt |codegroup
  19. fi
  20.  
  21. if [[ $cmdopt == "-d" ]]; then
  22.     echo "#---------------------------------------------------"
  23.     echo "# Type in the codegroup enccoded data to decrypt"
  24.     echo "# and hit ctrl-d when done."
  25.     echo "# Then you'll be asked for your encryption key."
  26.     echo "# After that, you'll get the ccrypt decrypted"
  27.     echo "# version of your encrypted data."
  28.     echo "#---------------------------------------------------"
  29.     todecrypt=$(cat)
  30.     echo "$todecrypt" |codegroup -d |ccrypt -d
  31. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement