By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,922 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,922 IT Pros & Developers. It's quick & easy.

MD5 problem

P: n/a
Hi.

I'm in trouble with the md5 module.

Under Linux, it's ok, I get real signatures.

The problem is under Windows XP, with some kind of files.

If I use the md5 module with .txt files, it'ok.

The Problem comes from the .msg files. I get the same signature for
every .msg file I try to hash with the md5 algorithm. I think some
character are strange for python, and makes it stop before the end of
the .msg file.

So, my question is : Do anybody have a solution to this problem ? (I can
post my source code if needed)

Thank you.
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
fargo wrote:
Hi.

I'm in trouble with the md5 module.

Under Linux, it's ok, I get real signatures.

The problem is under Windows XP, with some kind of files.

If I use the md5 module with .txt files, it'ok.

The Problem comes from the .msg files. I get the same signature for
every .msg file I try to hash with the md5 algorithm. I think some
character are strange for python, and makes it stop before the end of
the .msg file.


That sounds like you opened the file in text mode. For things like this
it is better to open it in binary mode: file(filename, 'rb')
--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton

Roel Schroeven
Jul 19 '05 #2

P: n/a
Roel Schroeven wrote:
fargo wrote:
Hi.

I'm in trouble with the md5 module.

Under Linux, it's ok, I get real signatures.

The problem is under Windows XP, with some kind of files.

If I use the md5 module with .txt files, it'ok.

The Problem comes from the .msg files. I get the same signature for
every .msg file I try to hash with the md5 algorithm. I think some
character are strange for python, and makes it stop before the end of
the .msg file.

That sounds like you opened the file in text mode. For things like this
it is better to open it in binary mode: file(filename, 'rb')


It was excatly the problem.

Thank you for your help.
Jul 19 '05 #3

P: n/a
On Mon, 13 Jun 2005 14:00:33 +0200, rumours say that fargo
<fa******@hotmail.com> might have written:
If I use the md5 module with .txt files, it'ok.

The Problem comes from the .msg files. I get the same signature for
every .msg file I try to hash with the md5 algorithm. I think some
character are strange for python, and makes it stop before the end of
the .msg file.


FYI: the character that was strange for Windows (not Python) was
chr(26), or Ctrl-Z, or end-of-file, which is special for files opened as
text instead of binary.
--
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.