Annotation of libaitio/example/crypt.c, revision 1.2.56.1
1.2.56.1! misho 1: /* $Id: crypt.c,v 1.2 2011/04/19 20:00:30 misho Exp $ */
1.2 misho 2:
3: #include <stdio.h>
4: #include <unistd.h>
5: #include <string.h>
6: #include <aitio.h>
7:
8: int main(int argc, char **argv)
9: {
10: char ch, *str, mode = -1;
11: int len;
12:
13: while ((ch = getopt(argc, argv, "de")) != -1)
14: switch (ch) {
15: case 'e':
16: mode = 1;
17: break;
18: case 'd':
19: mode = 0;
20: break;
21: default:
22: printf("Not enough parameters ... blowfishche [-e|-d] <string>\n");
23: return 1;
24: }
25: argc -= optind;
26: argv += optind;
27: if (argc < 1 || -1 == mode) {
28: printf("Not enough parameters ... blowfishche [-e|-d] <string>\n");
29: return 1;
30: }
31:
1.2.56.1! misho 32: len = io_Blowfish((u_char*) argv[0], strlen(argv[0]), (unsigned char**) &str, NULL, NULL, mode);
1.2 misho 33:
34: if (len && str) {
35: printf("Action(%scrypt)%d: %s\n", !mode ? "de" : "en", len, str);
36: free(str);
37: } else
38: printf("Invalid action!!!\n");
39:
40: return 0;
41: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>