Page MenuHomec4science

FragmentPartial.java
No OneTemporary

File Metadata

Created
Tue, Jan 7, 01:09

FragmentPartial.java

package crypto.elgamal;
import org.bouncycastle.math.ec.ECPoint;
public class FragmentPartial extends FragmentEncrypted {
private ECPoint T;
private int partNumber;
public FragmentPartial(int partNumber, FragmentEncrypted encrypted, ECPoint T) {
super(encrypted.getR(), encrypted.getS());
if (!validPartNumber(partNumber)) {
throw new IllegalArgumentException("not a valid part number");
}
this.partNumber = partNumber;
this.T = T;
}
public ECPoint getT() {
return T;
}
public int getPartNumber() {
return partNumber;
}
private boolean validPartNumber(int partNumber) {
switch (partNumber)
{
case ECElGamal.PART_SPU:
case ECElGamal.PART_MU:
return true;
default:
return false;
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((T == null) ? 0 : T.hashCode());
result = prime * result + partNumber;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
FragmentPartial other = (FragmentPartial) obj;
if (T == null) {
if (other.T != null)
return false;
} else if (!T.equals(other.T))
return false;
if (partNumber != other.partNumber)
return false;
return true;
}
public boolean equalsFragmentEncrypted(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
return true;
}
}

Event Timeline