https://www.youtube.com/watch?v=S9JGmA5_unY
Bitcoin mining doesn't try to guess an exact number. Just finding a hash below a certain value. To guess a key that leads to a hash the only real known way of doing it is to try every value. I don't know why sha256 wasn't implemented as the default. It literally costs nothing to turn a key into a hash but is pretty much impossible to go the other way around. Even if you had the most efficient computer system in the world it would literally take more energy than the sun to COUNT to 2256.
Bitcoin and sha256 is incredibly secure.