This document presents an algebraic algorithm for solving linear congruences and applies it to cryptography. It begins with background information on linear congruences and number theory. It then describes developing an algebraic algorithm that converts linear congruences into linear equations to solve them algebraically. This is a simpler approach than existing methods. Examples are provided to validate the algorithm. The paper also demonstrates applying the algorithm to solve linear congruences involved in the RSA public key cryptography system.