These docs are for v2.0. Click to read the latest docs for v3.0.

Retreive the 32 byte namespace biased SHA512H of the currently executing Hook

Behaviour

  • Look up the hash of the hook installed on hook account at position hook_no
  • Write the 32 byte hash to write_ptr

Definition

int64_t hook_hash (
    uint32_t write_ptr,
    uint32_t write_len,
  	int32_t  hook_no
);

Example

uint8_t hash[32];
int64_t bytes_written = 
    hook_hash(hash, 32, -1);

Parameters

NameTypeDescription
write_ptruint32_tPointer to a buffer of a suitable size to store the output. Should be at least 32 bytes.
write_lenuint32_tLength of the output buffer.
hook_noint32_tThe position in the hook chain the hook is located at, or -1 for the currently executing hook.

Return Code

TypeDescription
int64_tThe number of bytes written

If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.

DOESNT_EXIST
- The specified hook sequence number doesn't exist in the hook chain.