Friday, August 27, 2010

Create a series of md5 digests from a file

You can create md5 digests from a file, each line in the file is a different digest.
www.bonifazi.eu/appunti/createmd5.py

#!/usr/bin/python
import hashlib
import sys


f = open("my_lines.txt", "r")


for line in f.readlines():
    line = line.strip()


    m = hashlib.md5()
    m.update(line)
    print(line + ":::" + m.hexdigest())




f.close()

0 comments: