diff options
author | Paul Duncan <pabs@pablotron.org> | 2023-09-06 23:23:31 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2023-09-06 23:23:31 -0400 |
commit | 4eebef1961a1c01890fe11dc5f1b9f3a1ea705e0 (patch) | |
tree | c48e3f15f1f26ce4456c549c2211545e8448cfac /examples/00-sha3-256/main.c | |
parent | 7887a482dc7951a88fd0b2a4caa8988f0aef4340 (diff) | |
download | sha3-4eebef1961a1c01890fe11dc5f1b9f3a1ea705e0.tar.bz2 sha3-4eebef1961a1c01890fe11dc5f1b9f3a1ea705e0.zip |
add examples/
Diffstat (limited to 'examples/00-sha3-256/main.c')
-rw-r--r-- | examples/00-sha3-256/main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/00-sha3-256/main.c b/examples/00-sha3-256/main.c new file mode 100644 index 0000000..26cdec3 --- /dev/null +++ b/examples/00-sha3-256/main.c @@ -0,0 +1,23 @@ +// +// sha3-256-example: print sha3-256 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[32] = { 0 }; + sha3_256(DATA, sizeof(DATA), buf); + + // print result to stdout + printf("SHA3-256: "); + hex_write(stdout, buf, sizeof(buf)); + printf("\n"); + + return 0; +} |