parent
0e8bf83dda
commit
16f952270c
3 changed files with 47 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package native
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"math"
|
||||
"math/big"
|
||||
|
@ -43,6 +44,26 @@ func TestRIPEMD160(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestMurmur32(t *testing.T) {
|
||||
c := newCrypto()
|
||||
ic := &interop.Context{VM: vm.New()}
|
||||
|
||||
t.Run("bad arg type", func(t *testing.T) {
|
||||
require.Panics(t, func() {
|
||||
c.murmur32(ic, []stackitem.Item{stackitem.NewInterop(nil), stackitem.Make(5)})
|
||||
})
|
||||
})
|
||||
t.Run("good", func(t *testing.T) {
|
||||
// Example from the C# node:
|
||||
// https://github.com/neo-project/neo/blob/2a64c1cc809d1ff4b3a573c7c22bffbbf69a738b/tests/neo.UnitTests/Cryptography/UT_Murmur32.cs#L18
|
||||
data := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1}
|
||||
seed := 10
|
||||
expected := make([]byte, 4)
|
||||
binary.LittleEndian.PutUint32(expected, 378574820)
|
||||
require.Equal(t, expected, c.murmur32(ic, []stackitem.Item{stackitem.NewByteArray(data), stackitem.Make(seed)}).Value().([]byte))
|
||||
})
|
||||
}
|
||||
|
||||
func TestCryptoLibVerifyWithECDsa(t *testing.T) {
|
||||
t.Run("R1", func(t *testing.T) {
|
||||
testECDSAVerify(t, Secp256r1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue