pass 469 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. site=$1
  3. limit=$2
  4. if [ $# -lt 1 ]; then
  5. read -ep "Site: " site
  6. fi
  7. if [ $# -lt 2 ]; then
  8. limit=20
  9. fi
  10. read -sep "Salt: " salt
  11. saltresult=`echo $salt | shasum -a 512`
  12. if [ "${saltresult:0:128}" == "8309357f48bd4cf5563dce72d4c0791067f9c4e8c7f3b85c800520c419f0525f4d5a080bed5941d267b3cfdb06250ae236f9ff44f6c12e3c9713e2e0a662ed7e" ]
  13. then
  14. result=`echo "$site$salt" | shasum`
  15. echo
  16. echo ${result:0:$limit}
  17. else
  18. echo "invalid salt!"
  19. fi