MD5 problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fargo

    MD5 problem

    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.
  • Roel Schroeven

    #2
    Re: MD5 problem

    fargo wrote:
    [color=blue]
    > 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.[/color]

    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

    Comment

    • fargo

      #3
      Re: MD5 problem

      Roel Schroeven wrote:[color=blue]
      > fargo wrote:
      >[color=green]
      >> 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.[/color]
      >
      >
      > 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')[/color]

      It was excatly the problem.

      Thank you for your help.

      Comment

      • Christos TZOTZIOY Georgiou

        #4
        Re: MD5 problem

        On Mon, 13 Jun 2005 14:00:33 +0200, rumours say that fargo
        <fargo_01@hotma il.com> might have written:
        [color=blue]
        >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.[/color]

        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

        Comment

        Working...