Jump to content

If md5 was not one way?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
If md5 was not one way.. would that mean that if we take the md5 of a file and then reverse it.. would that mean that the file will be regenerated?

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Yes. It would mean you could determine the code/password from the hash value.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It would also mean that MD5 hashes would generally be a similar size to the file. That would make it very impractical for quick checks against changes.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
So it would mean that the md5 will be a huge string?

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Exactly. Think of it this way: if you have 2 million different strings, and the "hash" is to be reversible, then they have to "hash" to 2 million different strings. Now think 2 billion, or 2 trillion. Eventually, your "hash" has to be able to grow.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
How does a hash work? I mean, what algorithm is it that prevents it from being decoded? The same password must be entered to create the same hash, correct? So why is it not possible to reverse that using the same code????

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What a hash does is crunch all the data down to a fixed length result string. A fairly simple hash would be to take a string, separate it out into 8 character substrings (padding the final substring up to 8 characters if needed), and then doing a bitwise xor on the substrings.
With a hash like that (we'll call it WP8 hash), the following strings would all have the same hash:
"aaaaaaaabbbbbbbb"
"ababababbabababa"
"aabbaabbbbaabbaa"
because in each case, you are doing an xor on "a" and "b"
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog