generate 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. echo -n "Enter your salt (won't be displayed): "
  3. read -s SALT
  4. echo -en "\n"
  5. #echo -n "Confirm: "
  6. #read -s SALT_CONFIRM
  7. #echo -en "\n"
  8. #if [ $SALT != $SALT_CONFIRM ]; then
  9. # echo "Confirm did not match. Program ending."
  10. # exit 1;
  11. #fi
  12. echo -n "Enter your string: "
  13. read STRING
  14. #echo -n "Confirm: "
  15. #read STRING_CONFIRM
  16. #if [ $STRING != $STRING_CONFIRM ]; then
  17. # echo "Confirm did not match. Program ending."
  18. # exit 1;
  19. #fi
  20. PASSWORD=$(echo -n "$SALT$STRING" | sha512sum | base64 -w 0)
  21. # Color the password output as black (assuming terminal background
  22. # is black) to avoid cameras/shoulder surfers seeing your password.
  23. # For other colors use the other ANSI escape codes:
  24. # Black 0;30 Dark Gray 1;30
  25. # Red 0;31 Light Red 1;31
  26. # Green 0;32 Light Green 1;32
  27. # Brown/Orange 0;33 Yellow 1;33
  28. # Blue 0;34 Light Blue 1;34
  29. # Purple 0;35 Light Purple 1;35
  30. # Cyan 0;36 Light Cyan 1;36
  31. # Light Gray 0;37 White 1;37
  32. # no color 0
  33. echo -n "Your password is: "
  34. echo -e "\033[0;30m${PASSWORD:0:32}\033[0m"
  35. exit 0;