init: v1.0.0
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package sm1
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSm1Block(t *testing.T) {
|
||||
key := []byte{0x40, 0xbb, 0x12, 0xdd, 0x6a, 0x82, 0x73, 0x86, 0x7f, 0x35, 0x29, 0xd3, 0x54, 0xb4, 0xa0, 0x26}
|
||||
msg := []byte{0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00}
|
||||
encMsg := []byte{0x6d, 0x7f, 0x45, 0xb0, 0x8b, 0xc4, 0xd9, 0x66, 0x44, 0x4c, 0x86, 0xc2, 0xb0, 0x7d, 0x29, 0x93}
|
||||
|
||||
buf, _ := EncryptECB(nil, key, msg)
|
||||
if !bytes.Equal(encMsg, buf) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
buf, _ = DecryptECB(nil, key, encMsg)
|
||||
if !bytes.Equal(msg, buf) {
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user