aboutsummaryrefslogtreecommitdiff
path: root/examples/00-sha3-256/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/00-sha3-256/main.c')
-rw-r--r--examples/00-sha3-256/main.c23
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;
+}