check result

This commit is contained in:
Emman 2021-12-31 13:16:15 +08:00
parent cbb6590042
commit 96059a7c75

View File

@ -5,12 +5,12 @@ package sm4
import ( import (
"crypto/rand" "crypto/rand"
"fmt"
"io" "io"
"reflect"
"testing" "testing"
"time"
) )
/*
func TestExpandKey(t *testing.T) { func TestExpandKey(t *testing.T) {
key := make([]byte, 16) key := make([]byte, 16)
@ -43,3 +43,18 @@ func TestExpandKey(t *testing.T) {
} }
} }
} }
*/
func TestExpandKeySimple(t *testing.T) {
key := make([]byte, 16)
encRes1 := make([]uint32, 32)
decRes1 := make([]uint32, 32)
encRes2 := make([]uint32, 32)
decRes2 := make([]uint32, 32)
io.ReadFull(rand.Reader, key)
expandKeyGo(key, encRes1, decRes1)
expandKeyAsm(&key[0], &ck[0], &encRes2[0], &decRes2[0])
fmt.Printf("expected=%v, result=%v\n", encRes1, encRes2)
fmt.Printf("expected=%v, result=%v\n", decRes1, decRes2)
}