1 7 package java.security.spec; 8 9 import java.math.BigInteger ; 10 11 22 public class ECPoint { 23 24 private final BigInteger x; 25 private final BigInteger y; 26 27 30 public static final ECPoint POINT_INFINITY = new ECPoint (); 31 32 private ECPoint() { 34 this.x = null; 35 this.y = null; 36 } 37 38 46 public ECPoint(BigInteger x, BigInteger y) { 47 if ((x==null) || (y==null)) { 48 throw new NullPointerException ("affine coordinate x or y is null"); 49 } 50 this.x = x; 51 this.y = y; 52 } 53 54 59 public BigInteger getAffineX() { 60 return x; 61 } 62 63 68 public BigInteger getAffineY() { 69 return y; 70 } 71 72 79 public boolean equals(Object obj) { 80 if (this == obj) return true; 81 if (this == POINT_INFINITY) return false; 82 if (obj instanceof ECPoint ) { 83 return ((x.equals(((ECPoint )obj).x)) && 84 (y.equals(((ECPoint )obj).y))); 85 } 86 return false; 87 } 88 89 93 public int hashCode() { 94 if (this == POINT_INFINITY) return 0; 95 return x.hashCode() << 5 + y.hashCode(); 96 } 97 } 98 | Popular Tags |