#How to perform exponentiation with a different exponent in base 2?
2 messages · Page 1 of 1 (latest)
One way to implement something like this is the sqaure and multiply algorithm, https://en.wikipedia.org/wiki/Exponentiation_by_squaring https://www.practicalnetworking.net/stand-alone/square-and-multiply/
I did something a while ago. No garuantee, likely needs some work https://github.com/Trivo25/o1js-elgamal/blob/main/src/lib.ts#L9
In mathematics and computer programming, exponentiating by squaring is a general method for fast computation of large positive integer powers of a number, or more generally of an element of a semigroup, like a polynomial or a square matrix. Some variants are commonly referred to as square-and-multiply algorithms or binary exponentiation. These c...
Exponentiation can be done in far fewer calculations that multiplying the base number over and over using the Square and Multiply method. Learn how in this article.