hook_hash
Behaviour
Section titled “Behaviour”- Look up the hash of the hook installed on hook account at position
hook_no - Write the 32 byte hash to
write_ptr
- Look up the hash of the hook installed on the hook account at the specified position.
- The Namespace biased SHA512H of the currently executing Hook, or an error code if the lookup fails.
Definition
Section titled “Definition”int64_t hook_hash ( uint32_t write_ptr, uint32_t write_len, int32_t hook_no);function hook_hash(hookno: number): ErrorCode | ByteArrayExample
Section titled “Example”uint8_t hash[32];int64_t bytes_written = hook_hash(hash, 32, -1);const hash = hook_hash(hookno)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| write_ptr | uint32_t | Pointer to a buffer of a suitable size to store the output. Should be at least 32 bytes. |
| write_len | uint32_t | Length of the output buffer. |
| hook_no | int32_t | The position in the hook chain the hook is located at, or -1 for the currently executing hook. |
| Name | Type | Description |
|---|---|---|
| hook_no | number | The position in the hook chain the hook is located at, or -1 for the currently executing hook. |
Return Code
Section titled “Return Code”| Type | Description |
|---|---|
| int64_t | The number of bytes written |
| Type | Description |
|---|---|
| ByteArray or ErrorCode | Returns the Namespace biased SHA512H of the currently executing Hook, or an error code if the lookup fails. |