
org.spongycastle.crypto.params.CramerShoupParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
The newest version!
package org.spongycastle.crypto.params;
import java.math.BigInteger;
import org.spongycastle.crypto.CipherParameters;
import org.spongycastle.crypto.Digest;
public class CramerShoupParameters implements CipherParameters {
private BigInteger p; // prime order of G
private BigInteger g1, g2; // generate G
private Digest H; // hash function
public CramerShoupParameters(BigInteger p, BigInteger g1, BigInteger g2, Digest H) {
this.p = p;
this.g1 = g1;
this.g2 = g2;
this.H = H;
}
public boolean equals(Object obj) {
if (!(obj instanceof DSAParameters)) {
return false;
}
CramerShoupParameters pm = (CramerShoupParameters) obj;
return (pm.getP().equals(p) && pm.getG1().equals(g1) && pm.getG2().equals(g2));
}
public int hashCode() {
return getP().hashCode() ^ getG1().hashCode() ^ getG2().hashCode();
}
public BigInteger getG1() {
return g1;
}
public BigInteger getG2() {
return g2;
}
public BigInteger getP() {
return p;
}
public Digest getH() {
H.reset();
return H;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy