| ▲ | Levitating 5 hours ago | ||||||||||||||||
> Since the file is 128 bits long, one would expect this place to be around the 2*128th bit. > Calculate the number of bits to encode that value using log2(938933556), which is ~29.8 Can someone explain these two statements to me? | |||||||||||||||||
| ▲ | csunoser 5 hours ago | parent | next [-] | ||||||||||||||||
for > Calculate the number of bits to encode that value using log2(938933556), which is ~29.8 This is roughly same as saying: "If you rewrite 938933556 as a binary number / usize, it will need 30 bits". Sanity check: 1101111111|0110111111|0100110100 (| delimits every 10 bigits). > Since the file is 128 bits long, one would expect this place to be around the 2*128th bit. This statement is a bit more subtle. As a first ord approximation, we can see pi sort of as a RNG. If we write pi (ignore the decimal point), as a binary number, we get: 11011001111111011110010101011110001010101111101101110001001100001... You can... kind of squint and pretend this is a random sequence of 1s and 0s. Now, if you had a file that is 128 bits (so lots of intermingling 0s and 1s), and each next digit of pi is effectively a coin flip. Pretend 1s are heads, and 0s are tails. You basically have to get the exact 128 consecutive coin flips of the same result as your file to get your file back. Imagine now, PI not as a number, but a sequence of experiments of flipping the coin 128 times.
You have to try, on expectation, quite a few times to win this game! Now, you could easily get lucky for sure. But on average, your chance of winning per attempt is roughly 0.5^128! So, how many times do you have to try to win this game? Something like 2^128 times - and you have to consider that each attempt uses 128 bits as well. So more like 2^135. But you don't have to start fresh in each attempt, you can see it as like this:
That's where the 2^128 number came from. | |||||||||||||||||
| |||||||||||||||||
| ▲ | thangalin 5 hours ago | parent | prev [-] | ||||||||||||||||
[dead] | |||||||||||||||||