Hashing and proof of work
A hash function takes any input and produces a fixed-length fingerprint. Change one character of the input and every character of the output changes. There is no way back: given a fingerprint, the only way to find an input that produces it is to keep guessing.
Add a single space at the end. The fingerprint is completely different, and always exactly 64 characters long.
Mining is a guessing game
A block is its data plus a throwaway number called a nonce. The block counts as mined only when its hash starts with some number of zeros. Nothing predicts which nonce will work, so a miner tries them one after another. That is the work in proof of work — and it is why rewriting a block is expensive rather than merely inconvenient.
Type anything into the data field. The block turns red because the hash no
longer starts with 0000. Press Mine and watch the nonce climb until it
does.
The difficulty here is fixed at four leading zeros so that mining finishes instantly. On the real network, difficulty adjusts continuously to hold the block rate steady as hash power comes and goes.