diff options
Diffstat (limited to 'examples/00-sha3-256')
-rw-r--r-- | examples/00-sha3-256/Makefile | 16 | ||||
l--------- | examples/00-sha3-256/hex.h | 1 | ||||
-rw-r--r-- | examples/00-sha3-256/main.c | 23 | ||||
l--------- | examples/00-sha3-256/sha3.c | 1 | ||||
l--------- | examples/00-sha3-256/sha3.h | 1 |
5 files changed, 42 insertions, 0 deletions
diff --git a/examples/00-sha3-256/Makefile b/examples/00-sha3-256/Makefile new file mode 100644 index 0000000..198831b --- /dev/null +++ b/examples/00-sha3-256/Makefile @@ -0,0 +1,16 @@ +CFLAGS=-W -Wall -Wextra -Werror -pedantic -std=c11 -O3 -march=native -mtune=native +APP=./sha3-256-example +OBJS=sha3.o main.o + +.PHONY=all + +all: $(APP) + +$(APP): $(OBJS) + $(CC) -o $(APP) $(CFLAGS) $(OBJS) + +%.o: %.c + $(CC) -c $(CFLAGS) $< + +clean: + $(RM) -f $(APP) $(OBJS) diff --git a/examples/00-sha3-256/hex.h b/examples/00-sha3-256/hex.h new file mode 120000 index 0000000..2adfa3e --- /dev/null +++ b/examples/00-sha3-256/hex.h @@ -0,0 +1 @@ +../../hex.h
\ No newline at end of file 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; +} diff --git a/examples/00-sha3-256/sha3.c b/examples/00-sha3-256/sha3.c new file mode 120000 index 0000000..4748193 --- /dev/null +++ b/examples/00-sha3-256/sha3.c @@ -0,0 +1 @@ +../../sha3.c
\ No newline at end of file diff --git a/examples/00-sha3-256/sha3.h b/examples/00-sha3-256/sha3.h new file mode 120000 index 0000000..b7c53d4 --- /dev/null +++ b/examples/00-sha3-256/sha3.h @@ -0,0 +1 @@ +../../sha3.h
\ No newline at end of file |