Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Topics

Recent Status Updates

View All Updates

- - - - -

md5 and files


  • Please log in to reply
4 replies to this topic

#1 baldgrapeape


    CC Lurker

  • Just Joined
  • Pip
  • 5 posts

Posted 20 October 2010 - 04:05 PM


If someone were writing a program to calculate an md5 hash of a file, (for this purpose let's say language doesn't matter) I wonder a few things which maybe you can help me with please.

If you have an audio file 2 minutes in length and have hashed it, would adding :05 of dead air (no noise, no hiss, nothing but dead air) would that change the hash value?

If you change the ID tag of the file would that change the hash?

What would the code be taking into account in order to render a change to a different md5.

Thanks a lot.

  • 0

#2 WingedPanther73


    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 20 October 2010 - 04:27 PM

The file is different.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

#3 Alexander



  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh!
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Delphi/Object Pascal, Visual Basic .NET, Assembly, Fortran, Bash, Others

Posted 20 October 2010 - 05:28 PM

A single binary bit changed will significantly modify the resulting MD5 hash, you can follow the source of the MD5 algorithm and see the significant steps it takes to do so.
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.

#4 baldgrapeape


    CC Lurker

  • Just Joined
  • Pip
  • 5 posts

Posted 21 October 2010 - 11:45 AM

Thanks for the replies.

I guess that makes sense that the ID is part of the actual file so the MD5 would change then.
  • 0

#5 zoranh


    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 187 posts

Posted 21 October 2010 - 02:14 PM

But if you are implementing hash algorithm on your own, then you can decide to skip part of the file, knowing the file format. For example, if you want ID tag to be modifiable without affecting hash value, then skip bytes containing ID when calculating hash.
  • 0

Also tagged with one or more of these keywords: md5

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download