This is the code used in my 3rd year group project, it's quite basic and not very modular, but it simulates the processes correctly. It's capable of simulating the generation of keys using the BB84 and B92 protocols. It can also simulate the process of discovering an eavesdropper for both protocols.
Python (>=3.13), NumPy (>=2.3.3) and matplotlib (>=3.10.6) are required.