Modular exponentiation

Modular exponentiation is about finding the value of the equation c = be mod m. This is the remainder when dividing be by m. It is the inverse function of the discrete logarithm. Because modular exponentiation is easy and fast, and finding the discrete logarithm is difficult, both are used in fields such as public-key cryptography.
Right-to-left binary method.
When dealing with very large whole numbers, directly finding the result can be very resource intensive. We can make some optimisations to save computation power with principles like exponention by squaring.
Let's solve c = be mod m: