mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 12:16:20 +08:00
internal/sm2ec: make sure point double is correct
This commit is contained in:
parent
d4a812927d
commit
700edb923d
@ -208,7 +208,6 @@ func TestScalarMult(t *testing.T) {
|
||||
fatalIfErr(t, err)
|
||||
p2, err := NewSM2P256Point().ScalarMult(G, scalar)
|
||||
fatalIfErr(t, err)
|
||||
fmt.Printf("scalar: %x, p2: %x\n", scalar, p2.Bytes())
|
||||
if !bytes.Equal(p1.Bytes(), p2.Bytes()) {
|
||||
t.Errorf("[k]G != ScalarBaseMult(k), k=%x, p1=%x, p2=%x", scalar, p1.Bytes(), p2.Bytes())
|
||||
}
|
||||
|
@ -203,4 +203,7 @@ func TestPointDouble(t *testing.T) {
|
||||
if !bytes.Equal(double1.Bytes(), double2.Bytes()) {
|
||||
t.Error("PointDouble6Times is incorrect")
|
||||
}
|
||||
if hex.EncodeToString(double1.Bytes()) != "0497662389f36ce643a47dcf644f700651e988794843797b0c4a69c806e78615c2cd4d9449aea5cac5328b8d67d4ae956f5eb06c4515ff01bd17eef58bf866b33f" {
|
||||
t.Errorf("PointDouble6Times is incorrect %x", double1.Bytes())
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user