From 6c30f7d432db1b0ba6f5380a3fbd2e64868877fd Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 10 May 2024 22:01:38 +0200 Subject: [PATCH] initialize res in java impl from values --- lab3/zad2/app/src/main/java/pl/jacekpoz/DHSetup.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lab3/zad2/app/src/main/java/pl/jacekpoz/DHSetup.java b/lab3/zad2/app/src/main/java/pl/jacekpoz/DHSetup.java index fc3e351..7139f68 100644 --- a/lab3/zad2/app/src/main/java/pl/jacekpoz/DHSetup.java +++ b/lab3/zad2/app/src/main/java/pl/jacekpoz/DHSetup.java @@ -74,7 +74,7 @@ public class DHSetup implements IDHSetup { @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);