View Source BitcoinLib.Script.Opcodes.Crypto.Sha256 (BitcoinLib v0.4.7)

Based on https://en.bitcoin.it/wiki/Script

Word OP_SHA256 Opcode 168 Hex 0xa8 Input in Output hash The input is hashed using SHA-256.

Link to this section Summary

Functions

Returns <<0xa8>>

The input is hashed using SHA-256.

v()

Returns 0xa8

Link to this section Types

@type t() :: BitcoinLib.Script.Opcodes.Crypto.Sha256

Link to this section Functions

@spec encode() :: <<_::8>>

Returns <<0xa8>>

examples

Examples

iex> BitcoinLib.Script.Opcodes.Crypto.Sha256.encode()
<<0xa8>>
@spec execute(t(), [<<_::264>> | list()]) :: {:ok, [<<_::256>> | list()]}

The input is hashed using SHA-256.

examples

Examples

iex> pub_key = <<0x0218fb7aff2c6cb9c25b7cd9aa0b9bdd712e5617f07cb0c96bdda0b44c25a5d25f::264>>
...> %BitcoinLib.Script.Opcodes.Crypto.Sha256{}
...> |> BitcoinLib.Script.Opcodes.Crypto.Sha256.execute([pub_key, 3])
{:ok, [<<0x01e9a3394b9fdf95aa04dcb91bf540aae4196bf8c550d9be4c2d0ff94fd505bd::256>>, 3]}
@spec v() :: 168

Returns 0xa8

examples

Examples

iex> BitcoinLib.Script.Opcodes.Crypto.Sha256.v()
0xa8