Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 28th, 2011  |  syntax: Python  |  size: 0.27 KB  |  views: 886  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. def Hasher(algorithm, blocksize):
  2.     def hash_file(file):
  3.         hash = algorithm()
  4.         with open(file, 'rb') as f:
  5.             for chunk in iter(lambda: f.read(4096), ''):
  6.                 hash.update(chunk)
  7.         return hash.hexdigest()
  8.     return hash_file