Post
Topic
Board Project Development
Merits 1 from 1 user
Re: "Proof of Work" - A game about the history of Bitcoin
by
stwenhao
on 08/06/2025, 18:00:17 UTC
⭐ Merited by askii (1)
Code:
gen_hash256(7,1,0) "0000000ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(6,1,0) "0000008ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(5,1,0) "00000f8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(4,1,0) "0000cf8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(3,1,0) "0007cf8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(2,1,0) "00a7cf8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(1,1,0) "0da7cf8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(0,1,0) "6da7cf8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
Oh, so that's how hashes are made!
Code:
gen_hash256(0,1,0x00000000) "6da7cf8ae82798beaba5537ef3b0dd551fef80af1e0239f061f33248589d801c"
gen_hash256(0,1,0xffffffff) "ef4ac5a4b4aed0339758c8af0811423763b64e534c85cc2d9c6ef3fbab87dcff"
There are only 2^32 possible outcomes, and everything is simply masked, to get the final value. Nice!

Quote
Perhaps I should increase the range of seeds to allow for some more creativity.
I think the fact, that your system has 32-bit entropy in practice, should be preserved. It makes it much easier to hack into the system, and user perception is still quite good, because making a collision will require checking 2^16 elements, and preimages would still require grinding 2^32 values.

Which means, that not only it is possible to hack into wallets, by guessing 32-bit seeds. It is also possible to hack into block hashes, in a very similar way. And if you spread the same seeds in different places in the code, then all of them are hackable. But: for a single player, maybe it should be considered a feature, and not a bug, for example because then, it is possible to test SHA-256 collisions or preimages, while checking only 2^16 or 2^32 hashes. Nice!

By the way, that also means, that after mining around 64k blocks, there would be block hash collisions! I wonder, if some things would crash because of that, or not. For example: what if there would be two or more block hashes, generated out of the same seeds? How getting block by hash would behave?