Guest User

Untitled

a guest
Feb 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. temp = 0
  2. #password variable
  3. password = "This10@#45yui"
  4. #length_of_password
  5. length_of_password = password.length
  6. #small_letter charater ----> result list
  7. small_letter = password.scan(/[a-z]/)
  8. #capital_letter
  9. capital_letter = password.scan(/[A-Z]/)
  10. #digit
  11. digit_letter = password.scan(/[0-9]/)
  12. #special_case
  13. special_letter = password.scan(/[\w]/)
  14. #charater length
  15. length_small = small_letter.length
  16. length_capital = capital_letter.length
  17. length_digit_letter = digit_letter.length
  18. length_special_letter = special_letter.length
  19.  
  20. if length_of_password >=10
  21. if length_small >= 3
  22. temp =temp + 1
  23. elsif length_small <=3 && length_small >=1
  24. temp = temp + 0.5
  25. end
  26. if length_capital >= 3
  27. temp =temp + 1
  28. elsif length_capital <=3 && length_capital >=1
  29. temp = temp + 0.5
  30. end
  31. if length_digit_letter >=3
  32. temp = temp + 1
  33. elsif length_digit_letter <= 3 && length_digit_letter >=1
  34. temp = temp + 0.5
  35. end
  36. if length_special_letter >=3
  37. temp = temp + 1
  38. elsif length_special_letter <= 3 && length_special_letter >=1
  39. temp = temp + 0.5
  40. end
  41. else
  42. puts " please choose strong password"
  43. end
  44.  
  45. puts "Strong of password #{temp}"+"from 4"
Add Comment
Please, Sign In to add comment