INNER CODE UNIT · Go
func
schollz/pake · pake.go:32
func (e *Edwards25519Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
p1, err1 := (&edwards25519.Point{}).SetBytes(ed25519PointFromBigInts(x1, y1))
p2, err2 := (&edwards25519.Point{}).SetBytes(ed25519PointFromBigInts(x2, y2))
if err1 != nil || err2 != nil {
return big.NewInt(0), big.NewInt(0)
}
result := (&edwards25519.Point{}).Add(p1, p2)
return ed25519PointToBigInts(result.Bytes())
}
// Subtract performs point subtraction for Edwards25519
func (e *Edwards25519Curve) Subtract(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
p1, err1 := (&edwards25519.Point{}).SetBytes(ed25519PointFromBigInts(x1, y1))
p2, err2 := (&edwards25519.Point{}).SetBytes(ed25519PointFromBigInts(x2, y2))
if err1 != nil || err2 != nil {
return big.NewInt(0), big.NewInt(0)
}
result := (&edwards25519.Point{}).Subtract(p1, p2)