Quantum key distribution (QKD) allows for communication between distant parties with security guaranteed by quantum theory. The main theoretical problem in QKD is to calculate the secret key rate for a given protocol. Analytical formulas for the key rate are known for protocols that have a high degree of symmetry, such as the BB84 and six-state protocols. However, experimental imperfections tend to break symmetries. Since symmetry is exploited in theoretical treatments, the effect of experimental imperfections on key rates is difficult to estimate. Furthermore, it is an interesting question whether (intentionally) asymmetric protocols could offer an advantage over their symmetric counterparts. In this work, we develop a robust numerical approach for calculating the key rate for arbitrary discrete-variable QKD protocols. Ultimately this approach will allow researchers to investigate the security of ``unstructured'' protocols, i.e., those that lack symmetry. Our approach relies on transforming the key rate calculation to the dual optimization problem, which can be solved efficiently with significantly fewer parameters than the primal problem, and gives reliable lower bounds on the key rate. We illustrate our method by giving tight lower bounds for some unstructured protocols for which the key rate was previously unknown.