Go Back   Wireless and Wifi Forums > News > Newsgroups > comp.security.misc
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-12-2006, 09:54 PM
Zak
Guest
 
Posts: n/a
Default Does MD5 include the file name?

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?

Reply With Quote
  #2 (permalink)  
Old 09-12-2006, 10:10 PM
Todd H.
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

Zak <duff@nomail.invalid> writes:
> 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?


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.

> (2) Is this just a quirk of my utility?


Nope.

--
Todd H.
http://www.toddh.net/

Reply With Quote
  #3 (permalink)  
Old 09-12-2006, 10:20 PM
Unruh
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

Zak <duff@nomail.invalid> writes:

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


Yes.



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


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


>(2) Is this just a quirk of my utility?


No.


Reply With Quote
  #4 (permalink)  
Old 09-13-2006, 08:57 PM
Zak
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

> Zak <duff@nomail.invalid> writes:
>> 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?



On 12 Sep 2006, Todd H. <comphelp@toddh.net> wrote:
>
> 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.



>> (2) Is this just a quirk of my utility?

>
> Nope.



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?

Reply With Quote
  #5 (permalink)  
Old 09-13-2006, 09:44 PM
Todd H.
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

Zak <duff@nomail.invalid> writes:

> 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?


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.
http://www.toddh.net/

Reply With Quote
  #6 (permalink)  
Old 09-13-2006, 10:51 PM
Doug McIntyre
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

Zak <duff@nomail.invalid> writes:
>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?


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.


Reply With Quote
  #7 (permalink)  
Old 09-14-2006, 04:36 AM
Zak
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

On 13 Sep 2006, Doug McIntyre <merlyn@geeks.org> wrote:

> Zak <duff@nomail.invalid> writes:
>>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?

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


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.

Reply With Quote
  #8 (permalink)  
Old 09-14-2006, 05:38 AM
Volker Birk
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

Zak <duff@nomail.invalid> wrote:
> Are there other widely used hashes such as the SHA
> hashes that do include the name of the file in their calculation?


This has nothing to do with hashing algorithms, it's an attribute of the
implementation of your checksum program.

BTW: SHA1 is b0rken, better use RIPEMD-160 instead.

Yours,
VB.
--
Viel schlimmer als die Implementation von PHP ist jedoch das Design.

Rudolf Polzer in de.comp.security.misc

Reply With Quote
  #9 (permalink)  
Old 09-14-2006, 06:07 AM
Todd H.
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

Zak <duff@nomail.invalid> writes:

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


Then just use md5sum for the hashing, and call it a day. It ignores
filenames.



--
Todd H.
http://www.toddh.net/

Reply With Quote
  #10 (permalink)  
Old 09-14-2006, 06:27 PM
jiang
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?


> Then just use md5sum for the hashing, and call it a day. It ignores
> filenames.



Now that we are at it, anyone can reccomend an easy freeware for Windows XP
to compare file hashes?


Reply With Quote
  #11 (permalink)  
Old 09-14-2006, 06:44 PM
Todd H.
Guest
 
Posts: n/a
Default Re: Does MD5 include the file name?

jiang <spam@no.thanks> writes:

> > Then just use md5sum for the hashing, and call it a day. It ignores
> > filenames.

>
>
> Now that we are at it, anyone can reccomend an easy freeware for Windows XP
> to compare file hashes?


cygwin.com framework includes md5sum by default i believe.

md5sum both files, and eyeball the resulting fingerprint.


--
Todd H.
http://www.toddh.net/

Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Viewing/opening file sent by secure method Zak alt.computer.security 1 02-28-2007 08:58 AM
Viewing/opening file sent by secure method Zak comp.security.misc 1 02-28-2007 08:58 AM
a strange DVD burner problem atalla alt.comp.hardware 0 12-07-2006 12:28 PM
Corrupt NTFS filesystem Citizen Bob alt.comp.hardware 144 11-11-2006 07:38 PM
Does MD5 include the file name? Zak alt.computer.security 9 09-14-2006 06:44 PM


All times are GMT. The time now is 04:29 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45