SHA3DIGEST224, SHA3DIGEST256, SHA3DIGEST384, and SHA3DIGEST512
Perform a SHA-3 hash of the text specified by an address and length and return a CHAR string with that hash value.
- p
- A pointer that specifies the address of a buffer to be hashed.
- n
- An expression that specifies the length (in bytes) of that buffer. It must have a computational type and will be converted to type size_t.
The length returned is one eighth of the bit length in the function name, so, for example, SHA3DIGEST256 returns a CHAR(32) value.
These functions generate code that executes the KLMD assembler instruction.
Examples
The following example performs a 256-bit SHA-3 hash of the text in a CHARACTER variable c.
dcl encoded char(32);
encoded = sha3digest256(addrdata(c), length(c));