1

Can i reverse sha256 hash like 2nd hash to 1st hash ?

  1. ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb
  2. da3811154d59c4267077ddd8bb768fa9b06399c486e1fc00485116b57c9872f5

2nd hash is generated by sha256(1) so is it possible to reverse to 1st hash ?

Moz k
  • 21
  • 1
  • 3

3 Answers3

1

Hashing is meant to be a one way process. If a hashing algorithm were easily reversible, then it would be insecure. To answer your question, no, it's not possible to "unhash" 2 and obtain 1. In order to "crack" the second hash, you would have to brute force it by computing the sha256 of other strings and comparing the result with 2. If they match, then you (probably) have the original string.

Pierce Griffiths
  • 733
  • 3
  • 15
1

In short, as of 2019, NO.

Cryptographic Hash functions are, in short, one-way deterministic but random functions. Deterministic means the same input has always the same output and the random in the sense that the output is unpredictable.

In Cryptography, we consider the security of hash functions by

  • Preimage-Resistance: for essentially all pre-specified outputs, it is computationally infeasible to find any input which hashes to that output, i.e., to find any preimage x' such that h(x') = y when given any y for which a corresponding input is not known.
  • 2nd-preimage resistance, weak-collision: it is computationally infeasible to find any second input which has the same output as any specified input, i.e., given x, to find a 2nd-preimage x' != x such that h(x) = h(x').
  • Collision resistance: it is computationally infeasible to find any two distinct inputs x, x' which hash to the same output, i.e., such that h(x) = h(x').

What you are looking for is the preimage. There are cryptographic hash functions like MD4 and SHA-1 for those collisions are found. But all of them are still have pre and 2nd-preimage resistance.

For Sha256 there are no known pre-secondary yet collision attacks. It is considered a secure hash function.

You may find some rainbow tables for SHA-256 that may include your hash values but probably not since the space is too big to cover.

kelalaka
  • 5,064
  • 5
  • 27
  • 44
0

Sha256 is a hash function, as defined in wikipedia https://en.wikipedia.org/wiki/Cryptographic_hash_function :

The ideal cryptographic hash function has five main properties:

  • it is deterministic so the same message always results in the same hash
  • it is quick to compute the hash value for any given message
  • it is infeasible to generate a message from its hash value except by trying all possible messages
  • a small change to a message should change the hash value so extensively that the new hash value appears uncorrelated with the old hash value
  • it is infeasible to find two different messages with the same hash value

By definition a hash function is useful as long as you cannot reverse to the input.

Tosch
  • 475
  • 5
  • 12