Also called "exponentiation by squaring". It uses O(log b) multiplications instead of the O(b) multiplications the previous algorithm needed. With a slight modification you can also make a bignum_binmod() version which takes a modulo of the result in each intermediate step of the exponentiation and is a key operation in RSA.
Also called "exponentiation by squaring". It uses O(log b) multiplications instead of the O(b) multiplications the previous algorithm needed. With a slight modification you can also make a bignum_binmod() version which takes a modulo of the result in each intermediate step of the exponentiation and is a key operation in RSA.