comparison bin/ed2k.py @ 124:5bafb912837e

Massive addition of old scripts collection.
author Edho Prima Arief <edho@myconan.net>
date Wed, 26 Oct 2011 15:22:00 +0700
parents
children
comparison
equal deleted inserted replaced
123:173833e4ba35 124:5bafb912837e
1 #!/usr/bin/env python
2
3 import os, sys
4 from Crypto.Hash import MD4
5
6 def ed2k(filename):
7 block = 9500*1024
8 hash = ""
9 file = open(filename, "rb")
10 fileblock = file.read(block)
11 while fileblock:
12 hash += MD4.new(fileblock).digest()
13 fileblock = file.read(block)
14 file.close()
15 return MD4.new(hash).hexdigest()
16
17 if __name__ == "__main__":
18 for file in sys.argv[1:]:
19 print "%s %s" %(ed2k(file), file)