diff options
Diffstat (limited to 'examples/01-shake128/main.c')
-rw-r--r-- | examples/01-shake128/main.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/01-shake128/main.c b/examples/01-shake128/main.c new file mode 100644 index 0000000..f2a2347 --- /dev/null +++ b/examples/01-shake128/main.c @@ -0,0 +1,24 @@ +// +// shake128-example: hash contents of DATA with SHAKE128 and print first +// 200 bytes of SHAKE128 hash of data to standard output. +// +#include <stdint.h> +#include <stdio.h> +#include "hex.h" +#include "sha3.h" + +// test data +static const uint8_t DATA[] = "this is some test data"; + +int main() { + // hash data + uint8_t buf[200] = { 0 }; + shake128_xof_once(DATA, sizeof(DATA), buf, sizeof(buf)); + + // print result to stdout + printf("SHAKE128 (200 bytes): "); + hex_write(stdout, buf, sizeof(buf)); + printf("\n"); + + return 0; +} |