From 63104f0716dc2d60842f19fc145ea4bcb096292d Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Mon, 6 Jul 2026 23:20:17 +0200 Subject: initial commit --- argon-test.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 argon-test.c (limited to 'argon-test.c') diff --git a/argon-test.c b/argon-test.c new file mode 100644 index 0000000..cd2dcff --- /dev/null +++ b/argon-test.c @@ -0,0 +1,39 @@ +// Standard C +#include +#include +#include +#include + +// PW-Hashing +#include + +int +main(void) +{ + const char pwd[] = "Hallo Welt"; + char salt[24]; + uint32_t t_cost = 20; + uint32_t m_cost = 1600; + uint32_t parallelism = 4; + uint32_t hashlength = 24; + char encoded[256] = { 0 }; + + arc4random_buf(salt, sizeof salt); + int res = argon2id_hash_encoded(t_cost, m_cost, parallelism, pwd, strlen(pwd), salt, sizeof salt, hashlength, encoded, sizeof encoded); + if ( res == ARGON2_OK ) { + printf("hash: %s\n", encoded); + + res = argon2id_verify(encoded, "Hallo Welt", 10); + if ( res == ARGON2_OK ) { + puts("Alles OK!"); + } + else { + fprintf(stderr, "Error: %s\n", argon2_error_message(res)); + } + } + else { + fprintf(stderr, "Error: %s\n", argon2_error_message(res)); + } + + return EXIT_SUCCESS; +} -- cgit v1.3