Advertisement
ALEXANDAR_GEORGIEV

safe_passwords_generator

Jun 11th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. max_x = int(input())
  2. max_y = int(input())
  3. max_pass = int(input())
  4.  
  5. min_a_ascii = 35
  6. max_a_ascii = 55
  7.  
  8. min_b_ascii = 64
  9. max_b_ascii = 96
  10.  
  11. passwords = []
  12.  
  13. a_ascii = min_a_ascii
  14. b_ascii = min_b_ascii
  15. password_count = 0
  16. is_finished = False
  17. for x in range(1, max_x + 1):
  18.     for y in range(1, max_y + 1):
  19.         a = chr(a_ascii)
  20.         b = chr(b_ascii)
  21.         password = f"{a}{b}{x}{y}{b}{a}"
  22.         # Check if password has been generated before
  23.         if password in passwords:
  24.             is_finished = True
  25.             break  # leave for y
  26.         passwords.append(passwords)
  27.         print(f"{password}|", end='')
  28.         password_count += 1
  29.         if password_count == max_pass:
  30.             is_finished = True
  31.             break  # leave for y
  32.  
  33.         a_ascii += 1
  34.         if a_ascii > max_a_ascii:
  35.             a_ascii = min_a_ascii
  36.  
  37.         b_ascii += 1
  38.         if b_ascii > max_b_ascii:
  39.             b_ascii = min_b_ascii
  40.  
  41.     if is_finished:  # leave also for x
  42.         break
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement