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
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
[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 =
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
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
[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()
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
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',
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.
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,
10 matches
Mail list logo