Imported Upstream version 2.7
[ossec-hids.git] / src / os_crypto / md5 / main.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "md5_op.h"
6
7 void usage(char **argv)
8 {
9     printf("%s file str\n%s str string\n",argv[0],argv[0]);
10     exit(1);
11 }
12
13 /* make main to compile (after the make md5)
14  * Example of the md5 API use
15  * Daniel B. Cid, dcid@ossec.net
16  */
17 int main(int argc, char ** argv)
18 {
19     os_md5 filesum;
20
21     if(argc < 3)
22         usage(argv);
23
24
25     if(strcmp(argv[1],"file") == 0)
26     {
27         OS_MD5_File(argv[2], filesum);
28     }
29
30     else if(strcmp(argv[1],"str") == 0)
31     {
32         OS_MD5_Str(argv[2], filesum);
33     }
34
35     else
36         usage(argv);
37
38     printf("MD5Sum for \"%s\" is: %s\n",argv[2],filesum);
39     return(0);
40 }
41
42 /* EOF */