How to convert SHA to plain text?

8,526

Solution 1

SHA-1, SHA-256, SHA-512 and all the other SHA functions are cryptographic hash functions. One of the defining properties of cryptographic hash functions is preimage resistance: given a cryptographic hash function F and a value h, it is infeasible to find a text m such that F(m) = h. Note that hashing is not encryption: with encryption, you can find the original if you find the decryption key, but with hashing, you can't find the original except by guessing, period.

If you have the hash of a text, the only ways to find the text are:

  • Make an exhaustive search. If you take all the computers existing today and devote them to this task, this will take about 100 quintillion times the age of the universe for SHA-1, and much, much longer for SHA-512. Bring a book.
  • Make a fundamental breakthrough in cryptography. This is theoretically possible in that nobody has been able to prove that any of the SHA-* family are actually cryptographic hash functions, we just believe they are because professional cryptographers have tried to break them for years and failed. Publish your technique, you'll be famous.
  • Guess the text. It's easy to verify each guess. Be prepared to go through a lot of wrong guesses. Depending on the length and complexity (more precisely, on the entropy introduced by the method used to generate the text), this may range anywhere between quick (e.g. if you know it's a dictionary word) and infeasible (e.g. if it's a string of 50 random letters).
  • Figure out what input was passed to the function by non-computational means, such as finding the person who submitted the text and hitting them with a wrench until they reveal the password, or digging through the server logs (if the text was logged somewhere).

Solution 2

It's simple. You can not. This is precisely why it's called Secure Hash Algorithm. You need the source that generates the SHA string to know what generates it. This is why it's used to verify data alteration/manipulation. Through there are ways to manipulate the resultant hash, you can not know the source that created that hash.

Share:
8,526

Related videos on Youtube

Romulus
Author by

Romulus

Updated on September 18, 2022

Comments

  • Romulus
    Romulus almost 2 years

    I have found out, how I can convert plain text into an SHA (http://hash.online-convert.com/sha512-generator), but how can I convert a SHA key to plain text?

    • Admin
      Admin over 9 years
      You can't. There's an infinite number of strings for a given SHA hash. Getting any one of them is by design extremely hard. That's hashing, not encoding nor encryption.
    • Admin
      Admin over 9 years
      @Romulus, that is true. While it is true that each key can be made from an infinite set of texts. In practice any real sha, will have only one text, this is because the probability of a text producing any particular sha is so mind bogglingly low. Therefore if you create a sha from a text, and remember this sha, but forget the text, and then in the future have a text and produce a sha, and the sha is the some as before, you can be sure that it is the same text. (You will, however, never be able to do this by guessing).
    • Admin
      Admin over 9 years
      I'm voting to close this question as off-topic because it is a general question about the SHA-2 family of hash functions, not about anything on-topic as given in help center.
    • Admin
      Admin over 4 years
      @Derobert The question is only off topic, once you know the answer.
    • Admin
      Admin over 4 years
      @ctrl-alt-delor I'm not sure that's true, but even if we take that as a given, I'm not following, I don't see what you're suggesting be done about it, or be done differently in the future (since this is a 4-yr-old question). OP may not realize a question is off topic for any number of reasons, and I don't think we should hold an occasional mistake against OP. We close off-topic questions to keep our site focused, which seems to me to apply regardless of when we discover it's out-of-scope.
  • Govind
    Govind over 9 years
    "Bring a book" +1
  • derobert
    derobert over 9 years
  • Romulus
    Romulus over 9 years
    Thank you for your elaborate answer. Now I understand better the difference between cryptographic and encryption.