Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import hashlib
  2.  
  3. def check_hashes(strings, target_hash):
  4. # Convert the target hash to lowercase
  5. target_hash = target_hash.lower()
  6.  
  7. # Loop through each string in the list
  8. for string in strings:
  9. # Compute the SHA-256 hash of the string
  10. hash = hashlib.sha256(string.encode()).hexdigest().lower()
  11.  
  12. # Compare the hash to the target hash
  13. if hash == target_hash:
  14. # If the hashes match, return the string
  15. return string
  16. # If no match is found, return None
  17. return None
  18.  
  19.  
  20. strings = [
  21. 'password',
  22. '123456',
  23. '12345678',
  24.  
  25. ...
  26. ...
  27. ...
  28.  
  29. 'evangeli',
  30. 'eeeee1',
  31. 'eyphed',
  32.  
  33. ]
  34.  
  35. target_hash = 'e6e62ee55819cdc13126a8633ee8c43eaf48abf491cbca92129ddf5505b70bc1'
  36. print(check_hashes(strings, target_hash)) # Outputs: 'foo'
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement