initialize res in java impl from values

This commit is contained in:
jacekpoz 2024-05-10 22:01:38 +02:00
parent 0cfb8a0580
commit 6c30f7d432
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -74,7 +74,7 @@ public class DHSetup<T extends IGF> implements IDHSetup<T> {
@Override
public T power(T a, long b) {
T aCopy = this.constructor.apply(new GF.Params(a.getCharacteristic(), a.getValue()));
T res = a;
T res = this.constructor.apply(new GF.Params(a.getCharacteristic(), a.getValue()));
while (b > 0) {
if (b % 2 == 1) {
res.multiplyAssign(aCopy);