0

I am encrypting password using DigestUtils.sha256Hex("password").I get encrypted password as 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8

I want original password string from encrypted . How shall i get it? Please help me. Thanks

Tobias
  • 7,238
  • 10
  • 46
  • 77
user100
  • 69
  • 4
  • 15

2 Answers2

3

The whole point of Sha256 hashing is that you cannot decrypt it. When doing a login check, you should hash the user entered password and match it with the one you've stored in your datalayer.

Scherling
  • 1,350
  • 2
  • 13
  • 23
  • +1. You should also only store a *salted* hash (something like `sha256Hex(salt+password)`. Otherwise any two users with the same password *in any system* get the the same hash and it becomes somewhat reversible using rainbow tables. For example, you can google 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8. – Thilo Oct 08 '14 at 09:07
1

DigestUtils.sha256Hex is not encription it is hash. Main property of hash it is irreversible

talex
  • 17,973
  • 3
  • 29
  • 66