2020-04-14 14:24:21 +00:00
|
|
|
package crypto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
2020-08-13 07:41:33 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/interop/interopnames"
|
2020-04-14 14:24:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-08-13 07:41:33 +00:00
|
|
|
ecdsaSecp256r1VerifyID = interopnames.ToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256r1"))
|
|
|
|
ecdsaSecp256k1VerifyID = interopnames.ToID([]byte("Neo.Crypto.VerifyWithECDsaSecp256k1"))
|
|
|
|
ecdsaSecp256r1CheckMultisigID = interopnames.ToID([]byte("Neo.Crypto.CheckMultisigWithECDsaSecp256r1"))
|
|
|
|
ecdsaSecp256k1CheckMultisigID = interopnames.ToID([]byte("Neo.Crypto.CheckMultisigWithECDsaSecp256k1"))
|
|
|
|
sha256ID = interopnames.ToID([]byte("Neo.Crypto.SHA256"))
|
|
|
|
ripemd160ID = interopnames.ToID([]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},
|
2020-07-29 10:43:29 +00:00
|
|
|
{ID: ecdsaSecp256k1VerifyID, Func: ECDSASecp256k1Verify},
|
2020-07-28 13:38:00 +00:00
|
|
|
{ID: ecdsaSecp256r1CheckMultisigID, Func: ECDSASecp256r1CheckMultisig},
|
2020-07-29 10:43:29 +00:00
|
|
|
{ID: ecdsaSecp256k1CheckMultisigID, Func: ECDSASecp256k1CheckMultisig},
|
2020-07-28 13:38:00 +00:00
|
|
|
{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
|
|
|
}
|