Skip to content

Commit 6e55c9c

Browse files
authored
Update DiffieHellman.java
1 parent d4e7bb6 commit 6e55c9c

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,4 @@ public BigInteger calculateSharedSecret(BigInteger otherPublicValue) {
3333
// Returns b^x mod p or a^y mod p
3434
return otherPublicValue.modPow(secret, prime);
3535
}
36-
37-
// Static utility methods for direct calculation (if needed)
38-
public static BigInteger calculatePublicValue(BigInteger base, BigInteger secret, BigInteger prime) {
39-
// Check for valid inputs
40-
if (base == null || secret == null || prime == null || base.signum() <= 0 || secret.signum() <= 0 || prime.signum() <= 0) {
41-
throw new IllegalArgumentException("Base, secret, and prime must be non-null and positive values.");
42-
}
43-
return base.modPow(secret, prime);
44-
}
45-
46-
public static BigInteger calculateSharedSecret(BigInteger otherPublicValue, BigInteger secret, BigInteger prime) {
47-
// Check for valid inputs
48-
if (otherPublicValue == null || secret == null || prime == null || otherPublicValue.signum() <= 0 || secret.signum() <= 0 || prime.signum() <= 0) {
49-
throw new IllegalArgumentException("Other public value, secret, and prime must be non-null and positive values.");
50-
}
51-
return otherPublicValue.modPow(secret, prime);
52-
}
5336
}

0 commit comments

Comments
 (0)