initialize all res in power to 1
This commit is contained in:
parent
b73102513e
commit
228258221c
2 changed files with 2 additions and 2 deletions
|
@ -59,7 +59,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
T power(T a, uint64_t b) {
|
T power(T a, uint64_t b) {
|
||||||
T res = a;
|
T res = 1;
|
||||||
while (b > 0) {
|
while (b > 0) {
|
||||||
if (b % 2 == 1) {
|
if (b % 2 == 1) {
|
||||||
res *= a;
|
res *= a;
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class DHSetup<T extends IGF> implements IDHSetup<T> {
|
||||||
@Override
|
@Override
|
||||||
public T power(final T a, long b) {
|
public T power(final T a, long b) {
|
||||||
T aCopy = this.constructor.apply(new GF.Params(a.getCharacteristic(), a.getValue()));
|
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) {
|
while (b > 0) {
|
||||||
if (b % 2 == 1) {
|
if (b % 2 == 1) {
|
||||||
res.multiplyAssign(aCopy);
|
res.multiplyAssign(aCopy);
|
||||||
|
|
Loading…
Reference in a new issue