Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CramerShoupPrivateKeyParameters.java « params « crypto « bouncycastle « org « java « main « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 79de46ad71d73e3ce0500e546f7a30c7e3fbe443 (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
54
55
56
57
58
59
60
61
package org.bouncycastle.crypto.params;

import java.math.BigInteger;

public class CramerShoupPrivateKeyParameters extends CramerShoupKeyParameters {
	
	private BigInteger x1, x2, y1, y2, z; // Z_p
	private CramerShoupPublicKeyParameters pk; // public key

	public CramerShoupPrivateKeyParameters(CramerShoupParameters params, BigInteger x1, BigInteger x2, BigInteger y1, BigInteger y2, BigInteger z) {
		super(true, params);

		this.x1 = x1;
		this.x2 = x2;
		this.y1 = y1;
		this.y2 = y2;
		this.z = z;
	}

	public BigInteger getX1() {
		return x1;
	}
	
	public BigInteger getX2() {
		return x2;
	}
	
	public BigInteger getY1() {
		return y1;
	}
	
	public BigInteger getY2() {
		return y2;
	}
	
	public BigInteger getZ() {
		return z;
	}
	
	public void setPk(CramerShoupPublicKeyParameters pk) {
		this.pk = pk;
	}
	
	public CramerShoupPublicKeyParameters getPk() {
		return pk;
	}

	public int hashCode() {
		return x1.hashCode() ^ x2.hashCode() ^ y1.hashCode() ^ y2.hashCode() ^ z.hashCode() ^ super.hashCode();
	}

	public boolean equals(Object obj) {
		if (!(obj instanceof CramerShoupPrivateKeyParameters)) {
			return false;
		}

		CramerShoupPrivateKeyParameters other = (CramerShoupPrivateKeyParameters) obj;

		return other.getX1().equals(this.x1) && other.getX2().equals(this.x2) && other.getY1().equals(this.y1) && other.getY2().equals(this.y2) && other.getZ().equals(this.z) && super.equals(obj);
	}
}