From 30ff6afe596eddafacf22b1a5b2d1a3d6254ea15 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 15:14:44 +0200 Subject: Adding upstream version 2.36.1. Signed-off-by: Daniel Baumann --- tests/helpers/test_md5.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/helpers/test_md5.c (limited to 'tests/helpers/test_md5.c') diff --git a/tests/helpers/test_md5.c b/tests/helpers/test_md5.c new file mode 100644 index 0000000..6f8dec4 --- /dev/null +++ b/tests/helpers/test_md5.c @@ -0,0 +1,29 @@ + +#include +#include + +#include "md5.h" + +int main(void) +{ + int i, ret; + struct UL_MD5Context ctx; + unsigned char digest[UL_MD5LENGTH]; + unsigned char buf[BUFSIZ]; + + ul_MD5Init( &ctx ); + + while(!feof(stdin) && !ferror(stdin)) { + ret = fread(buf, 1, sizeof(buf), stdin); + if (ret) + ul_MD5Update( &ctx, buf, ret ); + } + + fclose(stdin); + ul_MD5Final( digest, &ctx ); + + for (i = 0; i < UL_MD5LENGTH; i++) + printf( "%02x", digest[i] ); + printf("\n"); + return 0; +} -- cgit v1.2.3