2020-04-14 14:24:21 +00:00
|
|
|
package crypto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-07-10 06:56:15 +00:00
|
|
|
ecdsaSecp256r1VerifyID = emit.InteropNameToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
|
2020-07-13 10:39:36 +00:00
|
|
|
ecdsaSecp256r1CheckMultisigID = emit.InteropNameToID([]byte("Neo.Crypto.CheckMultisigWithECDsaSecp256r1"))
|
|
|
|
sha256ID = emit.InteropNameToID([]byte("Neo.Crypto.SHA256"))
|
2020-07-22 09:22:20 +00:00
|
|
|
ripemd160ID = emit.InteropNameToID([]byte("Neo.Crypto.RIPEMD160"))
|
2020-04-14 14:24:21 +00:00
|
|
|
)
|
|
|
|
|
2020-07-28 13:38:00 +00:00
|
|
|
var cryptoInterops = []interop.Function{
|
|
|
|
{ID: ecdsaSecp256r1VerifyID, Func: ECDSASecp256r1Verify},
|
|
|
|
{ID: ecdsaSecp256r1CheckMultisigID, Func: ECDSASecp256r1CheckMultisig},
|
|
|
|
{ID: sha256ID, Func: Sha256},
|
|
|
|
{ID: ripemd160ID, Func: RipeMD160},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
interop.Sort(cryptoInterops)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Register adds crypto interops to ic.
|
|
|
|
func Register(ic *interop.Context) {
|
|
|
|
ic.Functions = append(ic.Functions, cryptoInterops)
|
2020-04-14 14:24:21 +00:00
|
|
|
}
|