mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 09:33:36 +00:00
b8d82b49ec
Closes #1193.
23 lines
598 B
Go
23 lines
598 B
Go
package crypto
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/hash"
|
|
"github.com/nspcc-dev/neo-go/pkg/vm"
|
|
)
|
|
|
|
// Sha256 returns sha256 hash of the data.
|
|
func Sha256(ic *interop.Context, v *vm.VM) error {
|
|
msg := getMessage(ic, v.Estack().Pop().Item())
|
|
h := hash.Sha256(msg).BytesBE()
|
|
v.Estack().PushVal(h)
|
|
return nil
|
|
}
|
|
|
|
// RipeMD160 returns RipeMD160 hash of the data.
|
|
func RipeMD160(ic *interop.Context, v *vm.VM) error {
|
|
msg := getMessage(ic, v.Estack().Pop().Item())
|
|
h := hash.RipeMD160(msg).BytesBE()
|
|
v.Estack().PushVal(h)
|
|
return nil
|
|
}
|