Event-by-event Simulation of Quantum Cryptography Protocols ∗