Skip to content

Commit e2bf794

Browse files
committed
allow an argument to hash an arbitary value
1 parent a76076d commit e2bf794

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test_hash.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
#include <string.h>
33
#include "hash.h"
44

5-
int main( void )
5+
int main( int argc, char *argv[] )
66
{
7-
char clear[6];
7+
char clear[121];
88
char *hash;
99

10-
strcpy(clear, "test");
10+
if (argc < 2 || strlen(argv[1]) > 120)
11+
{
12+
strcpy(clear, "test");
13+
}
14+
else
15+
{
16+
strcpy(clear, argv[1]);
17+
}
1118

12-
printf( "\nUsing word 'test' (without the quotes)\n" );
19+
printf( "\nUsing word '%s' (without the quotes)\n", clear );
1320

1421
hash = mk_hash( clear, ALG_PHPMD5 );
1522
printf( "\nphp_md5 -> %s", hash);

0 commit comments

Comments
 (0)