Advertisement
SalemHermit

Task 3

Nov 24th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import hashlib
  2. start = 0x10000000 # Start with a four byte hex literal.
  3. end = 0xffffffff
  4.  
  5. # OTP from PCAP
  6. #b7519dbe34acf21e29e687c20b42b8805b4db9935bf7f73b352d1caccb02a566
  7.  
  8. # SHA3-256 Hashed OTP
  9. hash1 = '8b34947f13ce9014bfeccb41861c4350ff7d3f1f7bb92f112a82b7a0c81af96d'
  10.  
  11. # Loop through all possible 4-byte hex combinations, hash with sha3-256, and compare first 8 characters.
  12. for i in range(start, end +1):
  13.  var = hashlib.sha3_256((format(i, 'x')).encode('utf-8'))
  14.  var_hexdigest = var.hexdigest()
  15.  if var_hexdigest[:8] == hash1[:8]:
  16.  #if var_hexdigest == hash1:
  17.   print('bytes:', format(i, 'x'), '  hash:', var_hexdigest)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement