Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- temp = 0
- #password variable
- password = "This10@#45yui"
- #length_of_password
- length_of_password = password.length
- #small_letter charater ----> result list
- small_letter = password.scan(/[a-z]/)
- #capital_letter
- capital_letter = password.scan(/[A-Z]/)
- #digit
- digit_letter = password.scan(/[0-9]/)
- #special_case
- special_letter = password.scan(/[\w]/)
- #charater length
- length_small = small_letter.length
- length_capital = capital_letter.length
- length_digit_letter = digit_letter.length
- length_special_letter = special_letter.length
- if length_of_password >=10
- if length_small >= 3
- temp =temp + 1
- elsif length_small <=3 && length_small >=1
- temp = temp + 0.5
- end
- if length_capital >= 3
- temp =temp + 1
- elsif length_capital <=3 && length_capital >=1
- temp = temp + 0.5
- end
- if length_digit_letter >=3
- temp = temp + 1
- elsif length_digit_letter <= 3 && length_digit_letter >=1
- temp = temp + 0.5
- end
- if length_special_letter >=3
- temp = temp + 1
- elsif length_special_letter <= 3 && length_special_letter >=1
- temp = temp + 0.5
- end
- else
- puts " please choose strong password"
- end
- puts "Strong of password #{temp}"+"from 4"
Add Comment
Please, Sign In to add comment