mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 20:26:19 +08:00
check result
This commit is contained in:
parent
cbb6590042
commit
96059a7c75
@ -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)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user