MD5 problem

F

fargo

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.
 
R

Roel Schroeven

fargo said:
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')
 
F

fargo

Roel said:
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.
 
C

Christos TZOTZIOY Georgiou

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top