Hi All,
Can any one tell me the algorithm for MD5,SHA-256 encryption and decription. I can found MD5 emcryption but not unable to found decryption.

Thanks & Regards
Bhanu Teja M.

MD5 and SHA-256 are hash functions, not encryption algorithms. They only work one way, which is why you aren't finding anything else; that they are non-reversible is quite intentional.

Is this for something specific you're trying to accomplish, or are you just exploring security concepts?

As gusano79 said, hash functions are one-way, which makes them perfect for encrypting things like passwords. They are never decrypted, but instead the password a user enters when logging in is hashed. This hash is then comapred with the hash of the correct password which is on record.

If you want to reverse a hash, you'll have to do it indirectly, by undergoing a painstaking operation of brute-forcing it. For example generating strings in a predictable order (a,b,c,d,e,f ... aa,ab,ac .. ba,bb,bc etc.) and hashing each string until the produced hash matches the hash you wanted to reverse. This is extremely expensive (time, electricity used by the computer) so there's really no point.

What gusano79 and assembly guy said. The sources and description of function of the md5 and sha-nnn hash functions are freely available on the web. Here is a link to the md5 article on wikipedia, including very clearly written pseudo-code that should be easily converted to most any computer language. http://en.wikipedia.org/wiki/MD5

Hi gusano79,
Thanks for reply. I want to make my app secure, so i want to encrypt & decrypt my transactions every time. Is there any best algorithms for encryption and decryption?

which makes them perfect for encrypting things like passwords

Just so everyone's clear here: Hashing passwords is NOT encryption. It is part of a technique to verify (to a reasonable degree of confidence) that the password a user provides is correct without having to actually store or transmit the password itself.

(time, electricity used by the computer)

The electric bill doesn't matter; it's all about time. Brute-force attacks are defeated by making it impractical to run through all possible keys before the sun turns into a red giant.

I want to make my app secure, so i want to encrypt & decrypt my transactions every time.

If you're writing a web application, make sure your server only uses HTTPS. If you're managing your own connections, consider something like TLS.

Is there any best algorithms for encryption and decryption

For symmetric algorithms, AES is a common choice.

For asymmetric algorithms, RSA is widely used.

This article has been dead for over six months. Start a new discussion instead.