public void ExponentiateX(long pow, byte[] output) { ulong[] y = GcmUtilities.OneAsUlongs(); int bit = 0; while (pow > 0) { if ((pow & 1L) != 0) { EnsureAvailable(bit); GcmUtilities.Multiply(y, (ulong[])lookupPowX2[bit]); } ++bit; pow >>= 1; } GcmUtilities.AsBytes(y, output); }
public void ExponentiateX(long pow, byte[] output) { // Initial value is little-endian 1 ulong[] y = GcmUtilities.OneAsUlongs(); if (pow > 0) { ulong[] powX = Arrays.Clone(x); do { if ((pow & 1L) != 0) { GcmUtilities.Multiply(y, powX); } GcmUtilities.Square(powX, powX); pow >>= 1; }while (pow > 0); } GcmUtilities.AsBytes(y, output); }