Pastebin

Paste #3168: No description

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

import os
import sys
import hashlib

try:
    root = sys.argv[1]
except:
    root = "."

hashes = {}
for root, dirs, files in os.walk(root):
    path = root.split('/')
    for file in files:
        fpath = os.path.join("".join(path), file)
        hashes[fpath] = hashlib.md5(open(fpath, 'rb').read()).hexdigest()
        
fnames = sorted(hashes.keys())
dirhash = ""
for fname in fnames:
    dirhash += hashes[fname]
print hashlib.md5(dirhash).hexdigest()

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.