about MD5

Newbie Spellweaver
Joined
Mar 8, 2012
Messages
51
Reaction score
0
hi all,

anyone can tell me how actually MD5 works? i know it is a kind of encryption, but the decryption is not reverse? i encrypt a String value into a encrypted value, now how am i able to convert it back into the original string value?

**i tried the encryption and decryption in the website (they provide the encryption/decryption function).


anyone can explain the logic?


thanks very much in advanced.
 
The fact that you can't decrypt the password is the point, so that if someone has access to the password hashes, he still doesn't have access to the actual passwords.

How it works is
1. Let's say user password = ABCD
2. The MD5 hash is cb08ca4a7bb5f9683c19133a84872ca7
2. The database stores only the hash.
3. When the user keys in his password, the website will encrypt the
password and compare it against the stored hash.

If a hacker somehow gets access to the database, he only sees 'cb08ca4a7bb5f9683c19133a84872ca7', and not 'ABCD'. So the user password is more or less secured.

Both MD5 and SHA1 are both easily crackable. For hashing passwords something like bcrypt or PBKDF2 is recommended.
 
hi thanks, your explanation is great help for me.

previouly, i thought when user key in 'ABCD' as password, program will decrypt the MD5 and compare with the user-key-in password in order to validate user. Now i know the logic.

does the SHA-1 handle the encryption in the same way as MD5 that you have exlpained?
 
Both MD5 and SHA are cryptographic hash functions. They do the same thing, the only difference is the method used in creating the final output and the output itself.
 
onother one sir,
as what you say, 'Both MD5 and SHA1 are both easily crackable. For hashing passwords something like bcrypt or PBKDF2 is recommended.'

how about md5(md5(string))? is not advised? hmm. :?:
 
onother one sir,
as what you say, 'Both MD5 and SHA1 are both easily crackable. For hashing passwords something like bcrypt or PBKDF2 is recommended.'

how about md5(md5(string))? is not advised? hmm. :?:

Isn't really bad. It will just increase the time taken by attacker to brute-force it. Part of good security.
 
onother one sir,
as what you say, 'Both MD5 and SHA1 are both easily crackable. For hashing passwords something like bcrypt or PBKDF2 is recommended.'

how about md5(md5(string))? is not advised? hmm. :?:

Put yourself in the shoes of an attacker.

You have a database of common password- a huge database. You can perform md5() on those passwords to get the md5 result. You can just as easily use md5(md5()) on those passwords.

With an unknown salt such as md5('foo'.'barsalt') the password the user enters is 'foo' but the result hashed is 'foobarsalt' sothe hacker can not get the user's password 'foo' unless they figure out the salt is 'barsalt'. A better salt might be a collection of unchanging user data unique only to that user.
 
Last edited:
I don't know how MD5 works , but I do know , that once you encrypted there is no way back. All the md5 "decryption" sites and softwares are a lie , and they just contain a basic database that dumb users usually use as password , and compare the 2 md5 , if it matches .. than good job you decrypted it. This is why most sites encourages you to use at least one capital letter , and at least a number.

Other than that its impossible to decrypt it , and it's the most secure encryption ever!
 
. . . and it's the most secure encryption ever!

So close but this lost you a cigar. Try to avoid words like "most", "least", "always", or "never" as it's probably not true.

This is a more accurate ending,
Someone said:
. . . and it's one of the most secure encryption ever!

And if you get technical, a hash is something designed to be a one-way change with the intent of being irreversible- as you described. Encryption is changing something which must be reversible.

In theory, everything is reversible- but it must be technically possible for two or more inputs to MD5 to have identical outputs. So, you cannot ever be sure if the string you reversed from an MD5 hash is identical to the one originally hashed. So retrieving a password (with absolute certainty it is the password typed in by the user) by "reversing" MD5 or any hash algorithm (known to me) is theoretically impossible unless you listen to the original password or every action of the hashing algorithm (creating a computer simulated or real-life "time-machine").


You may not be able to reverse everything with absolute certainty, but there is no contradiction- it is theoretically possible to reverse anything in the known Universe. But it's very hard (I mean, probably impossible for humans in our lifetime) to reverse hashes with absolute certainty.
 
Last edited:
I don't know how MD5 works , but I do know , that once you encrypted there is no way back. All the md5 "decryption" sites and softwares are a lie , and they just contain a basic database that dumb users usually use as password , and compare the 2 md5 , if it matches .. than good job you decrypted it. This is why most sites encourages you to use at least one capital letter , and at least a number.

Other than that its impossible to decrypt it , and it's the most secure encryption ever!
Afaik they never claimed to reverse them :P.
What those sites usually have are bigass tables with md5 hashes generated associated with a phrase.
And keep in mind 2 words can have the same hash :P (The chance is extremely small, but it's possible).
 
use SHA-2(its 512 bit variation preferably) and you should be fine even without salt

Again, with a huge database of generic raw passwords and the ability to repeat your procedures in 1 step, that's no safer than MD5.... Maybe 0.0001% safer since it's harder to "reverse" it- even though MD5 hasn't been reversed yet, (afaik) either.
 
The method s-p-n described is just a dictionary brute force, and it can be used to crack any hashed password. But - if the password isn't in the dictionary, it isn't crackable.

So how do we make much more certain that a dictionary brute force won't crack our hashed password? Simple. Add a salt. s-p-n already said this, though.

In terms of preferred hash, I don't like md5 a whole lot because of the noticeable chance of different values having the same md5 hash, i.e. a clash. I recommend what foxx has already stated - SHA (512 bit).
 
The method s-p-n described is just a dictionary brute force, and it can be used to crack any hashed password. But - if the password isn't in the dictionary, it isn't crackable.

So how do we make much more certain that a dictionary brute force won't crack our hashed password? Simple. Add a salt. s-p-n already said this, though.

In terms of preferred hash, I don't like md5 a whole lot because of the noticeable chance of different values having the same md5 hash, i.e. a clash. I recommend what foxx has already stated - SHA (512 bit).

In the rare event (rare: 2^128) of a one-to-many collision, you can code a collision handler to change hash algorithms. If a second collision occurs, that's strange- but I reckon there are enough ways to assure none of your hashes are the same using a combination of salts and different hashing algorithms. It doesn't matter what type of hash you use so long as you can be safe from the popular dictionary brute force attacks and various others.. Don't let your salts leak, etc- but ALWAYS use a salt- no matter how many bits you're using :P.
 
Back