baby-step giant-step
solving gx ≡ h (mod p) by meeting in the middle. the discrete log, found in √n steps instead of n.
brute force guesses x=0,1,2,… and multiplies. baby-step giant-step does it smarter: write x = i·m + j with m=⌊√n⌋. then gim+j=h means gj = h·g−im. build a table of all the baby steps gj once, then walk the giant steps h·g−im and look each up. two lists, one collision — that collision is the answer.
why √n: the table has m=⌈√n⌉ entries and the giant walk takes at most m steps, so total work ~2√n. for a 256-bit prime that's already 2128 — which is why real crypto uses groups where √n is still too big, and why generic discrete log is called “hard”. this page only picks small primes so you can watch it happen.
one subtlety: g must generate a decent chunk of the group. if g is a small-order element the log may not exist for a given h, and the search returns “no solution” honestly.