Skip to content

Commit 1b384d6

Browse files
committed
Update ECC.java
1 parent a6acec8 commit 1b384d6

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/com/thealgorithms/ciphers

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/ciphers/ECC.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ public ECPoint add(ECPoint other, BigInteger p, BigInteger a) {
195195
BigInteger lambda;
196196
if (this.equals(other)) {
197197
// Special case: point doubling
198-
lambda = (this.x.pow(2).multiply(BigInteger.valueOf(3)).add(a)).multiply(this.y.multiply(BigInteger.valueOf(2)).modInverse(p)).mod(p);
198+
lambda = this.x.pow(2).multiply(BigInteger.valueOf(3)).add(a).multiply(this.y.multiply(BigInteger.valueOf(2)).modInverse(p)).mod(p);
199199
} else {
200200
// General case: adding two different points
201-
lambda = (other.y.subtract(this.y)).multiply(other.x.subtract(this.x).modInverse(p)).mod(p);
201+
lambda = other.y.subtract(this.y).multiply(other.x.subtract(this.x).modInverse(p)).mod(p);
202202
}
203203

204204
BigInteger xr = lambda.pow(2).subtract(this.x).subtract(other.x).mod(p);

0 commit comments

Comments
 (0)