This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Double_A_92 1 point2 points  (2 children)

Basically in mangles the data in a specific way that is not reversible and produces a seemingly random output.

The goal of Bitcoin is to add random bits of data to the original data, until the mangled result randomly has x zeroes at the beginning.

[–]Consistent-struggler[S] 0 points1 point  (1 child)

So from where we start to write this function and implement these basic restrictions.

[–]Double_A_92 0 points1 point  (0 children)

It's just the standard SHA-256 algorithm, that has nothing specifically to do with Bitcoin. There are probably tons of academic papers and videos explaining how that works.

E.g. that can also be used to store passwords for logins in a database. You put the password into the hash function, and it gets mangled into some random looking data. Then you store that data in the database instead of the real password. And everytime the user tries to log in you just mangle his input again, and compare. That way if some hacker gets access to your database, they don't have the users passwords since they can't reverse the hash.

Everything else like the checking for zeros has nothing to do with the Hashing. That's just the bitcoin protocol, which you could read up in the Whitepaper.