Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- sha = hashlib.sha256()
- f = open('vid1', 'rb')
- chunklist = []
- hashlist = []
- tmp = f.read(1024)
- while tmp:
- chunklist.append(tmp)
- tmp = f.read(1024)
- lasthash = hashlib.sha256(chunklist[-1]).digest()
- hashlist.append(lasthash)
- #hashbin = bin(int(lasthash, 16))
- #print(list1[-1] + lasthash)
- ctr = 0
- for i in reversed(range(0, len(chunklist) - 1)):
- currChunk = chunklist[i]
- currHashMaterial = currChunk + hashlist[ctr]
- currHash = hashlib.sha256(currHashMaterial).digest()
- hashlist.append(currHash)
- ctr += 1
- print(hashlist[-1].hex())
Add Comment
Please, Sign In to add comment