Does MD5 include the file name?

Discussion in 'Computer Security' started by Zak, Sep 12, 2006.

  1. Zak

    Zak Guest

    I am running XP.

    I have a utility which calculates the MD5 hash for individual files.

    I find that it calculates the same MD5 value even if I change the file's
    name.



    (1) Is the name of the file not used in calculating the MD5 value?

    (2) Is this just a quirk of my utility?
     
    Zak, Sep 12, 2006
    #1
    1. Advertisements

  2. Zak

    Todd H. Guest

    That is correct. The hash is computed from the data of hte file. The
    filename is stored in the FAT, or the NTFS equivalent thereof, not as
    part of the file data.
    Nope.
     
    Todd H., Sep 12, 2006
    #2
    1. Advertisements

  3. Zak

    Unruh Guest

    It is not included. MD5 of a file is the hash of the contents of that file.

    No.
     
    Unruh, Sep 12, 2006
    #3
  4. Zak

    Zak Guest


    Thanks fo the info. Are there other widely used hashes such as the SHA
    hashes that do include the name of the file in their calculation?
     
    Zak, Sep 13, 2006
    #4
  5. Zak

    Todd H. Guest

    I doubt it.

    Think about it, when someone downloads a file, they like to rename it
    sometimes, and what path theyput it in varies, so the absolute file
    name would be different, dependent on platform, some file systems can
    handle mixed case file names, others can't, etc etc.

    What situation do you have where you're so concerned about the
    filename being included in the check?

    There may be others ways leveraging OS calls to do what you want.
     
    Todd H., Sep 13, 2006
    #5
  6. A hash is just a hash of data. You need a higher level protocol to
    protect the filename.

    Say, a requirement of zip'ing the file up into a zip archive, and then
    running a hash over that zip file. You can verify your hash on the
    ZIP'd file, and be reasonably sure that the filename of the unzip file
    will be correct and the same.

    There's so many different systems out there that will most likely
    mangle the filename in new and strange ways that no typical hash
    function would handle a filename change, there'd be too many failures.
     
    Doug McIntyre, Sep 13, 2006
    #6
  7. Zak

    Zak Guest

    I have some speech audio files. One or two may have been re-worked
    while tinkering with the audio editor.

    I would like to hash them to check if one file is identical to another.
    But some names have changes so I don't want to us a hash calculation
    which might also base itself on the name.

    Seems from what folks say that it is very nnlikely.
     
    Zak, Sep 14, 2006
    #7
  8. Zak

    Todd H. Guest

    Then just use md5sum for the hashing, and call it a day. It ignores
    filenames.
     
    Todd H., Sep 14, 2006
    #8
  9. Zak

    jiang Guest


    Now that we are at it, anyone can reccomend an easy freeware for Windows XP
    to compare file hashes?
     
    jiang, Sep 14, 2006
    #9
  10. Zak

    Todd H. Guest

    cygwin.com framework includes md5sum by default i believe.

    md5sum both files, and eyeball the resulting fingerprint.
     
    Todd H., Sep 14, 2006
    #10
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.