The following are tools that, together, give you the power to do a compute a discrete logarithm with a birthday or baby-step-giant-step attack.
Setup (choose prime modulus p, primitive root g, and target h; set up R = Z/pZ)
Print some random powers of g
Print some random powers of g times h
Print some systematic powers of g
Print some systematic products of g and h
An extra box