Mercurial > ec-dotfiles
diff bin/ed2k.py @ 719:bcdf320dabf4 default tip
Rewrite the ed2k again in php
Getting openssl to hash md4 is a pain.
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 10 Dec 2023 00:35:22 +0900 |
parents | 1f8218896f2a |
children |
line wrap: on
line diff
--- a/bin/ed2k.py Mon Dec 19 05:46:25 2022 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -#!/usr/bin/env python - -import os, sys -from Crypto.Hash import MD4 - -def ed2k(filename): - block = 9500*1024 - hash = "" - file = open(filename, "rb") - fileblock = file.read(block) - while fileblock: - hash += MD4.new(fileblock).digest() - fileblock = file.read(block) - file.close() - return MD4.new(hash).hexdigest() - -if __name__ == "__main__": - for file in sys.argv[1:]: - print "%s %s" %(ed2k(file), file)