Advertisement
chatchai_j

My Password Generator v2.0

Feb 23rd, 2015
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. LOG="$HOME/.my_password_generator.log"
  4.  
  5. echo -n "Enter [Key]: "
  6. stty -echo
  7. read key
  8. stty echo
  9. # echo "[$key]"         # -- for debug only -- #
  10. echo "*******************"
  11. echo -n "Enter [Start Len]: "
  12. read start len
  13.  
  14. [ -z "$start" ] && echo "Pleas enter 'Start'" && exit
  15. [ -z "$len" ] && echo "Pleas enter 'Len'" && exit
  16.  
  17. L=$key
  18. K=""
  19. end=`expr $start + $len - 1`
  20. for i in `seq 1 129`; do
  21.         L=`echo -n $L | sha512sum -b | cut -f1 -d' '`
  22.         K="$K$L"
  23. done
  24. B=`echo $K | xz -c -f | base64 -w0`
  25. echo -n $B | cut -c${start}-${end}
  26. FP=`echo -n $B | sha512sum | cut -c1-4,125-128 | tr 'a-f' 'A-F'`
  27. echo "fingerprint: $FP"
  28. [ -e "$LOG" ] && echo "`date` | $FP $start" >> $LOG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement