Decrypt an username

Username is saved at server using bcrypt, however, I want to show user’s real name at client when user makes comments. How could I display the users’ real name. Please help and thanks.

Despite the “crypt” in the name, bcrypt is not an encryption/decryption algorithm; rather, it is a hash function. Hash functions are one-way functions. That is, you can create a hash value from a cleartext value but you cannot turn the hash back into cleartext again.

Hash functions like bcrypt are useful for storing passwords. When a user logs in, the typed-in password is bcrypt’ed, and the resulting hash value is compared against the hash value that is stored in the password database for this user. If the two hash values match, the user has successfully authenticated himself or herself.

When attackers steal the hash value, they cannot decrypt the password from the hash. Unfortunately, for the same reason, you cannot get the user’s real name back from a bcrypt’ed user name.

7 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.