native: implement CryptoLib contract

This commit is contained in:
Evgeniy Stratonikov 2021-02-15 18:43:10 +03:00 committed by Anna Shaleva
parent 19a23a36e4
commit 100f2db3fb
22 changed files with 240 additions and 172 deletions

View file

@ -8,16 +8,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
)
// SHA256 computes SHA256 hash of b. It uses `Neo.Crypto.SHA256` syscall.
func SHA256(b []byte) interop.Hash256 {
return neogointernal.Syscall1("Neo.Crypto.SHA256", b).(interop.Hash256)
}
// RIPEMD160 computes RIPEMD160 hash of b. It uses `Neo.Crypto.RIPEMD160` syscall.
func RIPEMD160(b []byte) interop.Hash160 {
return neogointernal.Syscall1("Neo.Crypto.RIPEMD160", b).(interop.Hash160)
}
// ECDsaSecp256r1Verify checks that sig is correct msg's signature for a given pub
// (serialized public key). It uses `Neo.Crypto.VerifyWithECDsaSecp256r1` syscall.
func ECDsaSecp256r1Verify(msg []byte, pub interop.PublicKey, sig interop.Signature) bool {