version 1.1, 2011/03/16 17:05:46
|
version 1.2, 2011/04/19 20:00:30
|
Line 0
|
Line 1
|
|
/* $Id$ */ |
|
|
|
#include <stdio.h> |
|
#include <unistd.h> |
|
#include <string.h> |
|
#include <aitio.h> |
|
|
|
int main(int argc, char **argv) |
|
{ |
|
char ch, *str, mode = -1; |
|
int len; |
|
|
|
while ((ch = getopt(argc, argv, "de")) != -1) |
|
switch (ch) { |
|
case 'e': |
|
mode = 1; |
|
break; |
|
case 'd': |
|
mode = 0; |
|
break; |
|
default: |
|
printf("Not enough parameters ... blowfishche [-e|-d] <string>\n"); |
|
return 1; |
|
} |
|
argc -= optind; |
|
argv += optind; |
|
if (argc < 1 || -1 == mode) { |
|
printf("Not enough parameters ... blowfishche [-e|-d] <string>\n"); |
|
return 1; |
|
} |
|
|
|
len = io_Blowfish(argv[0], strlen(argv[0]), (unsigned char**) &str, NULL, NULL, mode); |
|
|
|
if (len && str) { |
|
printf("Action(%scrypt)%d: %s\n", !mode ? "de" : "en", len, str); |
|
free(str); |
|
} else |
|
printf("Invalid action!!!\n"); |
|
|
|
return 0; |
|
} |