Computing the security of Quantum Key Distribution