md5 from python different then md5 from command line

2006-05-07 Thread [EMAIL PROTECTED]
Hi I noticed that the md5 computed with md5 module from python is different then the md5 sum computed with md5sum utility (on slackware and gentoo). i.e. $echo marius|md5sum 0f0f60ac801a9eec2163083a22307deb - test = md5.new(marius) print test.hexdigest() 242aa1a97769109065e3b4df359bcfc9 Any

Re: md5 from python different then md5 from command line

2006-05-07 Thread Just
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I noticed that the md5 computed with md5 module from python is different then the md5 sum computed with md5sum utility (on slackware and gentoo). i.e. $echo marius|md5sum 0f0f60ac801a9eec2163083a22307deb - test

Re: md5 from python different then md5 from command line

2006-05-07 Thread Dejan Rodiger
[EMAIL PROTECTED] said the following on 07.05.2006 12:07: Hi I noticed that the md5 computed with md5 module from python is different then the md5 sum computed with md5sum utility (on slackware and gentoo). i.e. $echo marius|md5sum 0f0f60ac801a9eec2163083a22307deb - test =

Re: md5 from python different then md5 from command line

2006-05-07 Thread Marius Ursache
echo adds a newline: import md5 test = md5.new(marius\n) print test.hexdigest() 0f0f60ac801a9eec2163083a22307deb Just Thanks, that was it ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: md5 from python different then md5 from command line

2006-05-07 Thread Paul Rubin
Marius Ursache [EMAIL PROTECTED] writes: import md5 test = md5.new(marius\n) print test.hexdigest() 0f0f60ac801a9eec2163083a22307deb Thanks, that was it ;) Also, the -n option suppresses the newline from echo: $ echo -n marius | md5sum 242aa1a97769109065e3b4df359bcfc9

Re: md5 from python different then md5 from command line

2006-05-07 Thread John Salerno
[EMAIL PROTECTED] wrote: Hi I noticed that the md5 computed with md5 module from python is different then the md5 sum computed with md5sum utility (on slackware and gentoo). i.e. $echo marius|md5sum 0f0f60ac801a9eec2163083a22307deb - test = md5.new(marius) print test.hexdigest()

Re: md5 from python different then md5 from command line

2006-05-07 Thread Paul Rubin
John Salerno [EMAIL PROTECTED] writes: Just a quick md5-related follow-up question: I was experimenting with it and making md5 sums for strings, but how do you use the md5 module to create a sum for an actual file, such as an .exe file? m = md5.new() f = file('foo.exe', 'b') # open in binary

Re: md5 from python different then md5 from command line

2006-05-07 Thread John Salerno
Paul Rubin wrote: John Salerno [EMAIL PROTECTED] writes: Just a quick md5-related follow-up question: I was experimenting with it and making md5 sums for strings, but how do you use the md5 module to create a sum for an actual file, such as an .exe file? m = md5.new() f = file('foo.exe',

Re: md5 from python different then md5 from command line

2006-05-07 Thread Paul Rubin
John Salerno [EMAIL PROTECTED] writes: Any reason you can't just read the whole file at once and update m? Yes, you could say print md5.new(file('foo.exe').read()).hexdigest() but that means reading the whole file into memory at once. If the file is very large, that could thrash or fail.

Re: md5 from python different then md5 from command line

2006-05-07 Thread John Salerno
Paul Rubin wrote: John Salerno [EMAIL PROTECTED] writes: Any reason you can't just read the whole file at once and update m? Yes, you could say print md5.new(file('foo.exe').read()).hexdigest() but that means reading the whole file into memory at once. If the file is very large,