public boolean isOnCurve ( Curve curve ) { switch ( repr ) { case P2 : case P3 : FieldElement recip = Z . invert ( ) ; FieldElement x = X . multiply ( recip ) ; FieldElement y = Y . multiply ( recip ) ; FieldElement xx = x . square ( ) ; FieldElement yy = y . square ( ) ; FieldElement dxxyy = curve . getD ( ) . multiply ( xx ) . multiply ( yy ) ; return curve . getField ( ) . ONE . add ( dxxyy ) . add ( xx ) . equals ( yy ) ; default : return toP2 ( ) . isOnCurve ( curve ) ; } }
Verify that a point is on the curve .