I encrypted password using MD5 and inserted them to MySQL database. But, How can I decrypt that password to the original and place them in a jTextField.
2 Answers
MD5 is supposed to be one-directional function so in theory there is no way to decrypt it... instead of decrypting it - compare encrypted valued for password validation, but you will not be able to show the original password to the user.
BTW I said supposed as md5 is quite weak for security (and can be broken)

- 1,954
- 10
- 14
MD5 is a hashing function, not encryption, this means is irreversible. Thus can't be decrypted. What you can do is compare the resulting hash of a known input against another hash.
Depending on what you are trying to do, you should consider using another hashing function, since:
The MD5 algorithm is a widely used hash function producing a 128-bit hash value. Although MD5 was initially designed to be used as a cryptographic hash function, it has been found to suffer from extensive vulnerabilities. It can still be used as a checksum to verify data integrity, but only against unintentional corruption.
If you are interested in alternatives check here on how to store passwords.

- 4,714
- 2
- 30
- 46