MCPcopy Index your code
hub / github.com/btcsuite/btcd / opcodeSha256

Function opcodeSha256

txscript/opcode.go:1906–1915  ·  view source on GitHub ↗

opcodeSha256 treats the top item of the data stack as raw bytes and replaces it with sha256(data). Stack transformation: [... x1] -> [... sha256(x1)]

(op *opcode, data []byte, vm *Engine)

Source from the content-addressed store, hash-verified

1904//
1905// Stack transformation: [... x1] -> [... sha256(x1)]
1906func opcodeSha256(op *opcode, data []byte, vm *Engine) error {
1907 buf, err := vm.dstack.PopByteArray()
1908 if err != nil {
1909 return err
1910 }
1911
1912 hash := sha256.Sum256(buf)
1913 vm.dstack.PushByteArray(hash[:])
1914 return nil
1915}
1916
1917// opcodeHash160 treats the top item of the data stack as raw bytes and replaces
1918// it with ripemd160(sha256(data)).

Callers

nothing calls this directly

Calls 2

PopByteArrayMethod · 0.80
PushByteArrayMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…