You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
517 B

  1. package ecc
  2. import (
  3. "bytes"
  4. "math/big"
  5. )
  6. var (
  7. bigZero = big.NewInt(int64(0))
  8. zeroPoint = Point{bigZero, bigZero}
  9. )
  10. // Point is the data structure for a point, containing the X and Y coordinates
  11. type Point struct {
  12. X *big.Int
  13. Y *big.Int
  14. }
  15. // Equal compares the X and Y coord of a Point and returns true if are the same
  16. func (c1 *Point) Equal(c2 Point) bool {
  17. if !bytes.Equal(c1.X.Bytes(), c2.X.Bytes()) {
  18. return false
  19. }
  20. if !bytes.Equal(c1.Y.Bytes(), c2.Y.Bytes()) {
  21. return false
  22. }
  23. return true
  24. }