How to create a system to generate hashes and break without the original string?

Asked

Viewed 737 times

7

Is there any way to break Sha-256? There is a mathematical process to break?

I need to create a program that generates several hashes and another to break without having the original string (similar to Bitcoin), just using processing.

  • No way. These cryptographic hashes are made precisely to be very difficult to guess the input.

  • But how the bitcoin mining system manages to break?

  • I know the algorithm solves mathematical puzzles, but I don’t understand the process.

  • 3

    The bitcoin system doesn’t break. It sets a limit to what is an "acceptable" hash (e.g.: 10 zeros on the left) and any hash that satisfies this condition is accepted in blockchain. If a value exact not all miners in the world could break a single hash...

  • 2

1 answer

8

The SHA-256, like any well-made hash system, is resistant to pre-image ("single-hand function"). This means that, given the value of a hash, it is impractical to discover (with high probability) any data that gives rise to that hash. Thus, the only known way to "reverse the hash" is to generate a large amount of data and hash them one by one, until you get the same result as the original hash.

Because SHA-256 is a fairly fast - and easily parallelized - hash, it is possible to break many hashes if the original data is a reasonably short string (e.g., typical user passwords). For this reason it is often used in conjunction with a salt, which is a random value that is concatenated to the given before it is hashed, and then saved along with the hash value. If this salt is long enough (nowadays 64 bits are used, I think, but to ensure 128 or more) then it is totally impractical to reverse the hash - because the number of attempts needed to hit is higher than the combined computational power of all humanity.

(I said nonsense: the difficulty to reverse one hash is the same, using salt or not; salt only prevents you from breaking many hashes using a single processing. Do not use SHA-256 to protect passwords, or any other data from low entropy. Unless you can keep the salt secret, of course, but then it’s called the "key" and the resulting construction is a form of MAC.)

Note: you mention Bitcoin, but the Bitcoin mining system does not reverse hashes no part of its operation. What is done is to take the hash of the block being formed (includes the hash of all the blockchain behind it, in a structure known as Merkle Tree) and attach a random value, hashing and seeing if the result meets the network difficulty criterion. This criterion is basically to check whether the final value is less than or equal to an arbitrary value, which is set up or down depending on the combined processing power of the entire Bitcoin network (estimated according to the frequency with which new blocks are created, compared to the target of 1 block every 10 minutes).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.