+ Post New Thread
Results 1 to 6 of 6
Windows Thread, MD5 Hash (Checksum) in Technical; Silly question, but how does MD5 hashing work in terms of what does the function base it on? Does it ...
  1. #1

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,702
    Thank Post
    335
    Thanked 517 Times in 485 Posts
    Rep Power
    180

    MD5 Hash (Checksum)

    Silly question, but how does MD5 hashing work in terms of what does the function base it on? Does it base it on name/size? Or is it supposed to work on actual file coding, and if so how would checking it client side work?

    If it's just name/size etc, isn't it possible for files to have the same hash but be totally different?

    Or have I missed something :P

    Many thanks,
    Steve

  2. #2

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,817
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350
    my understanding of it (although limited through moodle) was that for passwords anyway - it is only reversible if you have the correct salt key which can decode the hash

    but i might be completely wrong!

  3. Thanks to glennda from:

    Steve21 (10th July 2011)

  4. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,702
    Thank Post
    335
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Quote Originally Posted by glennda View Post
    my understanding of it (although limited through moodle) was that for passwords anyway - it is only reversible if you have the correct salt key which can decode the hash

    but i might be completely wrong!
    That's more hash keys, but same kind of thing. It's used a lot for checking integrity when files are downloaded (example: > Ubuntu > Ubuntu 11.04 - LQ ISO )

    The idea being, once downloaded you can do a MD5Hash of the file, and if it's the same as the key on the website it means it's a proper, legal download, with no errors/bits missing etc.

    Just trying to work out, what details of the original ISO would be the same once you downloaded it. Name obviously, Things like dates wouldn't? etc etc.

    Steve

  5. #4

    dhicks's Avatar
    Join Date
    Aug 2005
    Location
    Knightsbridge
    Posts
    5,656
    Thank Post
    1,262
    Thanked 783 Times in 680 Posts
    Rep Power
    236
    Quote Originally Posted by Steve21 View Post
    Silly question, but how does MD5 hashing work in terms of what does the function base it on?
    The MD5 (or any checksum) algorithm works with whatever data you feed it. When you say "MD5" you might well mean a specific function in a particular language's library, in which case you're best off checking what, exactly, that function does with whatever data you give it. I think it's normal for most languages to have both an MD5 function to take a file handle, read all data from that file handle, and return an MD5 checksum value, and to have another funtion that just takes arbitary data as a string or similar and return the MD5 checksum of that (Python's standard library has both functions). The read-whole-file method might, obviously, take a while if it's a large file so you could speed things up by just giving the MD5 algorithm a string formatted with the file's name, size, maybe the modification date and so on, and get an MD5 checksum back from that, or maybe just read chunks of the given file, not the whole thing.

    If it's just name/size etc, isn't it possible for files to have the same hash but be totally different?
    It's possible for files to have the same hash, yes - a "collision" in the hashing algorithm. The MD5 algorythm is designed to minimise this happening - the chances of two files producing the same hash are something like one in several billion. However, bear in mind that that's for the contents of whole files - hashing different data (i.e. strings representing file modification and size data) might cause more potential collisions. Wikipedia's MD5 page would probably be a good place to start reading up.

    MD5 is a cryptographic hash, used for file verification and to produce near-garunteed non-identical hash values. Some hashing algorithms are simpler and designed for things like placing items in hash tables, where collisions are to be expected. Those types of hashing algorithm will be considerably quicker to run. Is there something particular you're trying to do?

  6. Thanks to dhicks from:

    Steve21 (10th July 2011)

  7. #5

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,702
    Thank Post
    335
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Quote Originally Posted by dhicks View Post
    Is there something particular you're trying to do?
    Lets just say it's part of my "annoy the lovely little darlings" projects

    Just trying to forsee any simple avoidance methods on checks for files.

    Steve

  8. #6

    dhicks's Avatar
    Join Date
    Aug 2005
    Location
    Knightsbridge
    Posts
    5,656
    Thank Post
    1,262
    Thanked 783 Times in 680 Posts
    Rep Power
    236
    Quote Originally Posted by Steve21 View Post
    Just trying to forsee any simple avoidance methods on checks for files.
    You mean for the only-allow-these-checksumed-executables feature in Active Directory? That should examine the contents of the file itself, changing the modified date and so on won't produce a different checksum. Note that simply appending a few bytes to the end of an executable will produce a different checksum, so the feature's only really useful when use as only-allow-these-checksums, not dissalow-these-particular-checksums.

SHARE:
+ Post New Thread

Similar Threads

  1. [SCCM 2007] 0x80091007 - The hash value is not correct
    By adamf in forum O/S Deployment
    Replies: 16
    Last Post: 31st March 2011, 01:10 PM
  2. File blocking based on a hash value
    By phodge in forum Windows
    Replies: 1
    Last Post: 30th March 2010, 03:11 PM
  3. Replies: 0
    Last Post: 11th June 2009, 02:23 PM
  4. Replies: 3
    Last Post: 5th February 2009, 09:55 PM
  5. HASH Rules
    By bigb3n in forum Windows
    Replies: 3
    Last Post: 29th October 2007, 01:20 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •