Presenting output from md5.digest like md5sum from GNU textutils

Moshe Zadka moshez at math.huji.ac.il
Mon May 29 08:53:21 EDT 2000


On Mon, 29 May 2000, [iso-8859-1] Pål Sollie wrote:

> Being a clueless newbie at Python I have no idea how to do this.
> 
> I am trying to write a script that is to save the checksum of all the
> specified files to a database. I'd like to convert the output I get
> from md5.digest to a human-readable format. Decimal values would be
> OK, but I'd be thrilled to get the same output as md5sum from GNU
> textutils.

try:

for c in digest:
	sys.stdout.write("%02X" % ord(c))

--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list