From: Jean-Marc Pigeon (Delson) Date: Mon, 7 Jul 2025 22:50:11 +0000 (-0400) Subject: Improving digmd5.c (tools) X-Git-Tag: tag-0.13~26 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=2c6ccca3489e4571a653c68855e0121583cc60ea;p=jmp%2Fmailleur Improving digmd5.c (tools) --- diff --git a/lib/unidig.h b/lib/unidig.h index 417322d..d742a85 100644 --- a/lib/unidig.h +++ b/lib/unidig.h @@ -30,10 +30,13 @@ extern RSPTYP *dig_freeresp(RSPTYP *resp); //the structure extern RSPTYP *dig_parseresp(char *response); -//procedure to convert a string to a 128 Bit sequence -//as a string +//procedure to hash (md5) a string result is a MD5 arrays extern MD5TYP *dig_hashmd5(unsigned char *seq,unsigned int length); +//procedure to convert an MD5 string (HEXA representation) +//to an pure MD5TYP structure +extern MD5TYP *dig_get_plain_md5(char *hexa); + //Procedure to crypt a string with MD5 hash function extern char *dig_cryptmd5(const void *key,unsigned char *seq); diff --git a/lib/DIGEST-MD5 b/tools/DIGEST-MD5 similarity index 100% rename from lib/DIGEST-MD5 rename to tools/DIGEST-MD5 diff --git a/lib/DIGEST-MD5-1 b/tools/DIGEST-MD5-1 similarity index 100% rename from lib/DIGEST-MD5-1 rename to tools/DIGEST-MD5-1 diff --git a/lib/DIGEST-MD5-2 b/tools/DIGEST-MD5-2 similarity index 100% rename from lib/DIGEST-MD5-2 rename to tools/DIGEST-MD5-2 diff --git a/tools/digmd5.c b/tools/digmd5.c index cb915ac..a5a6881 100644 --- a/tools/digmd5.c +++ b/tools/digmd5.c @@ -97,6 +97,7 @@ _Bool proceed; status=0; params=(ARGTYP *)0; +foreground=true; phase=0; proceed=true; while (proceed==true) { @@ -107,8 +108,9 @@ while (proceed==true) { break; case 1 : //check if we have file to scan if (params->argc!=2) { - (void) rou_alert(0,"Unable to proceed with test\n"); - (void) rou_alert(0,"\tthe test pattern number should be 2\n"); + (void) rou_alert(0,"Unable to proceed with test"); + (void) rou_alert(0,"\tthe test pattern number should be 2"); + (void) rou_alert(0,"\tsee Makefile 'tstmd5:' entry as example"); status=-1; phase=999; } @@ -121,6 +123,14 @@ while (proceed==true) { break; case 3 : //doing main task status=chkresponse(params->argc,params->argv); + switch (status) { + case 0 : + (void) rou_alert(0,"dig_hashresp is working ok"); + break; + default : + (void) rou_alert(0,"dig_hashresp is NOT working fine"); + break; + } break; case 4 : //main task completed (void) prc_cleantitle();