blob: 24264b6cea5d3df030c1785e83cca0c16b28cc6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package org.bouncycastle.crypto.params;
import java.math.BigInteger;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.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;
}
}
|