diff --git a/lab3/zad1/include/DHSetup.hpp b/lab3/zad1/include/DHSetup.hpp index 2c08c54..d31f437 100644 --- a/lab3/zad1/include/DHSetup.hpp +++ b/lab3/zad1/include/DHSetup.hpp @@ -59,7 +59,7 @@ public: } T power(T a, uint64_t b) { - T res = a; + T res = 1; while (b > 0) { if (b % 2 == 1) { res *= a; 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 a65497f..1074d1c 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(final T a, long b) { T aCopy = this.constructor.apply(new GF.Params(a.getCharacteristic(), a.getValue())); - T res = this.constructor.apply(new GF.Params(a.getCharacteristic(), a.getValue())); + T res = this.constructor.apply(new GF.Params(a.getCharacteristic(), 1)); while (b > 0) { if (b % 2 == 1) { res.multiplyAssign(aCopy);