init: v1.0.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package gcltests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"xdx.jelly/xgcl/sm/sm2"
|
||||
"xdx.jelly/xgcl/sm/sm3"
|
||||
)
|
||||
|
||||
func SM3Test() bool {
|
||||
data := hexDecode("763AFC537F7876C2D0B59FDB68D762E90CEFD222BB358D0D6931867CE26538649BE3579A4004483EA5D84D005063F76FB1CE7E5F2F933B5ED757A718182F383C4D58291A6A5D8D07C081F66806031539093362D854883A8874F7B919925DABC74C173E2162F07E6780E311FF0AEF059AE620303DECB6289E97F72C018723C471")
|
||||
stdDigest := hexDecode("d32b9d793b4966e18c351892e65277756ef0cc9d28db954c959fbb85e3948442")
|
||||
digest := sm3.Sum(data)
|
||||
return bytes.Equal(digest[:], stdDigest)
|
||||
}
|
||||
|
||||
func SM3WithIDTest() bool {
|
||||
pk := &sm2.PublicKey{}
|
||||
pk.SetBytes(hexDecode("127E9EA1805767FD68BF73097231642B3044EEEBB0EBC9A3848100EF455BF5F945709988D547B9E7CB24F276709607A16E25E3B242E54C5FB54DB1F93EE3873E"))
|
||||
id := hexDecode("D208DC5A50CC8144FA7F644D5708655F")
|
||||
|
||||
data := hexDecode("1670390FB93CC01CC2C880BB43454119")
|
||||
stdDigest := hexDecode("FD8FD32ABB888167FD4502DA3F23AC39CA90C87907547D4E334A1CB96E98717B")
|
||||
digest := sm2.PreComputeWithIdAndPubkeyAndMessage(id, data, pk)
|
||||
return bytes.Equal(digest[:], stdDigest)
|
||||
}
|
||||
Reference in New Issue
Block a user