Find Modulo of Exponent - Two Pointers / Advanced

https://algo.monster/problems/find_modulo_of_exponent

Wow this is almost magic. I don’t see this method mentioned in https://en.wikipedia.org/wiki/Modular_exponentiation. Maybe I missed it? Is there a name for this way of modular exponentiation?