Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. def rotate(cipher_grille):
  2. rotated_grille = ['','','','']
  3. for i in range(3,-1,-1):
  4. for j in range(4):
  5. if j==0:
  6. rotated_grille[0]=rotated_grille[0]+cipher_grille[i][j]
  7. if j==1:
  8. rotated_grille[1]=rotated_grille[1]+cipher_grille[i][j]
  9. if j==2:
  10. rotated_grille[2]=rotated_grille[2]+cipher_grille[i][j]
  11. if j==3:
  12. rotated_grille[3]=rotated_grille[3]+cipher_grille[i][j]
  13. rotated_grille=tuple(rotated_grille)
  14. return rotated_grille
  15.  
  16.  
  17. def recall_password(cipher_grille, ciphered_password):
  18.  
  19. password = ''
  20. for i in range(len(cipher_grille)):
  21. for j in range(4):
  22. if cipher_grille[i][j] == 'X':
  23. password = password + ciphered_password[i][j]
  24.  
  25. for x in range(3):
  26. cipher_grille=rotate(cipher_grille)
  27. for i in range(4):
  28. for j in range(4):
  29. if cipher_grille[i][j] == 'X':
  30. password = password + ciphered_password[i][j]
  31. return password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement