-3

I have a requirement to reverse translate a SHA1 encrypted text to plain text.

I need the Java Code to it.

many forums say that it cant be done but i have found a link http://www.stringfunction.com/sha1-decrypter.html which does exactly the same. I have tested it. Now i need the algorithm to implement in Java.

Please help!!!

Fr_nkenstien
  • 1,923
  • 7
  • 33
  • 66
  • What have you tried? StackOverflow isn't a place for people to write code for you. – Saladin Akara Sep 14 '12 at 07:16
  • 2
    That "decrypter" didn't work for the first hash I tried (`04bc143ee82d851eaa4ead7fefd7790ccad8d5fe`). harhar... Google for "preimage attack" and you'll realize why this isn't feasible with current technology. – Mysticial Sep 14 '12 at 07:17

3 Answers3

12

It's plain impossible. SHA1, like all cryptographic digest algorithms, is not an encryption algorithm, but a hashing algorithm. It takes any text, as long as you want, and transforms it into a few bytes, in a way that is impossible to revert, by design. The whole point of a cryptographic hash is to be one-way, and thus impossible to revert. If it was possible, the algorithm would be useless.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
0

No you cannot do that, the website you gave is based on pre-generated mapping database, and it could only find a string which exists in its database.

  1. SHA1 is a digest algorithm, it's a many to 1 mapping, so theoretically speaking you could find many strings which give you the same SHA1 value.

  2. It's made to be hard to reverse calculate.

So there's no go.

agou
  • 728
  • 1
  • 10
  • 24
0

I'm pretty certain it isn't possible to decrypt SHA1. The only way I know of is to bruteforce it, to generate random strings and encrypt them until you find the match, which could take an extremely long time, if the text isn't very complex. The solution the link you provided is to have an enormous database with a lot of strings and it's SHA1 equalient, but that generally wont work unless the original text exist in the database.

galaxyAbstractor
  • 537
  • 1
  • 4
  • 13