Matrix cryptosystems, like Hill cipher, are resistant to frequency analysis. The key is a non-singular k times k matrix, for example 3 times 3 matrix K. In this paper, we propose simple criteria to generate a modular non-singular key-matrix for matrix ciphers fast. We apply these results to cryptography and computer security. In this paper, we present a mutualauthentication protocol based on Hamiltonian cycle in directed weight graphs and modular matrix algebra.