comparison bin/ed2k.py @ 138:f963d52c031a

Merge.
author Edho Arief <edho@myconan.net>
date Wed, 02 Nov 2011 22:12:16 +0700
parents 5bafb912837e
children
comparison
equal deleted inserted replaced
137:983beb13c736 138:f963d52c031a
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)