Guest User

Untitled

a guest
Jun 25th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import hashlib
  2. sha = hashlib.sha256()
  3.  
  4. f = open('vid1', 'rb')
  5.  
  6. chunklist = []
  7. hashlist = []
  8.  
  9. tmp = f.read(1024)
  10.  
  11. while tmp:
  12. chunklist.append(tmp)
  13. tmp = f.read(1024)
  14.  
  15.  
  16. lasthash = hashlib.sha256(chunklist[-1]).digest()
  17. hashlist.append(lasthash)
  18. #hashbin = bin(int(lasthash, 16))
  19.  
  20. #print(list1[-1] + lasthash)
  21.  
  22. ctr = 0
  23. for i in reversed(range(0, len(chunklist) - 1)):
  24. currChunk = chunklist[i]
  25. currHashMaterial = currChunk + hashlist[ctr]
  26. currHash = hashlib.sha256(currHashMaterial).digest()
  27. hashlist.append(currHash)
  28. ctr += 1
  29.  
  30. print(hashlist[-1].hex())
Add Comment
Please, Sign In to add comment