blob: b24550c8c6cfc04273a6a34a39171b182dab91a8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using System;
namespace Org.BouncyCastle.Crypto.Modes.Gcm
{
[Obsolete("Will be removed")]
public class BasicGcmExponentiator
: IGcmExponentiator
{
private GcmUtilities.FieldElement x;
public void Init(byte[] x)
{
GcmUtilities.AsFieldElement(x, out this.x);
}
public void ExponentiateX(long pow, byte[] output)
{
GcmUtilities.FieldElement y;
GcmUtilities.One(out y);
if (pow > 0)
{
GcmUtilities.FieldElement powX = x;
do
{
if ((pow & 1L) != 0)
{
GcmUtilities.Multiply(ref y, ref powX);
}
GcmUtilities.Square(ref powX);
pow >>= 1;
}
while (pow > 0);
}
GcmUtilities.AsBytes(ref y, output);
}
}
}
|