Keccak functions¶
-
int eth_keccak256(uint8_t *dest, const uint8_t *bytes, size_t len)¶
Computes the keccak hash for the input data.
#include <stdio.h> #include <ethc/keccak256.h> int main(void) { uint8_t keccak[32], data[2] = {0x28, 0xa1}; size_t datalen = 2, i; eth_keccak256(keccak, data, datalen); for(i = 0; i < 32; i++) printf("%.2x", keccak[i]); printf("\n"); return 0; }
- Parameters
dest – [out] A pointer to a 32-byte array to write the hash to.
bytes – [in] A pointer to the input data.
len – [in] The length of the input data.
-
int eth_keccak256p(uint8_t *dest, const uint8_t *bytes, size_t len)¶
Computes the keccak hash for the input data with
\x19Ethereum Signed Message:\n
prefix.- Parameters
dest – [out] A pointer to a 32-byte array to write the hash to.
bytes – [in] A pointer to the input data.
len – [in] The length of the input data.