Пример #1
0
func (p *point) Null() abstract.Point {
	C.ge_p3_0(&p.p)
	return p
}
Пример #2
0
func TestCurve25519() {

	var x point

	p0 := point{}
	C.ge_p3_0(&p0.p)
	println("zero", p0.String())
	p0.validate()

	b := point{}
	b.Base()
	println("base", b.String())
	b.dump()
	b.validate()

	x.Base()
	x.Mul(&x, &s0)
	println("base*0", x.String())
	x.validate()

	x.Base()
	x.Mul(&x, &s1)
	println("base*1", x.String())
	x.validate()

	bx2 := point{}
	bx2.Mul(&b, &s2)
	println("base*2", bx2.String())
	bx2.validate()

	r := C.ge_p1p1{} // check against doubling function
	C.ge_p3_dbl(&r, &b.p)
	C.ge_p1p1_to_p3(&x.p, &r)
	println("base*2", x.String())
	x.validate()

	bx4 := point{}
	bx4.Mul(&b, &s4)
	println("base*4", bx4.String())
	bx4.validate()

	bx2x2 := point{}
	bx2x2.Mul(&bx2, &s2)
	println("base*2*2", bx2x2.String())
	bx2x2.validate()

	x.Add(&b, &p0)
	println("base+0", x.String())
	x.Add(&p0, &b)
	println("0+base", x.String())
	x.validate()
	x.validate()

	x.Add(&b, &b)
	println("base+base", x.String())
	//x.validate()

	x.Add(&b, &bx2)
	println("base+base*2", x.String())
	//x.validate()

	x.Add(&x, &b)
	println("base+base*3", x.String())
	//x.validate()

	//	g := NewCurve25519()
	//	crypto.TestGroup(g)
}