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