summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
index a35cd04..fc08977 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,34 @@
Use `make` to build a minimal test application, and `make test` to run
the test suite.
+## Examples
+
+```c
+// 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;
+}
+```
+
+See the `examples/` directory for more examples.
+
## References
* [FIPS 202 - SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions][FIPS 202]