Put this project under version control, finally.
This commit is contained in:
commit
8dec6dff87
11 changed files with 3461 additions and 0 deletions
28
quickrypt.c
Normal file
28
quickrypt.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <crypt.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char clear[32], enc[120], *ptr;
|
||||
fgets(&clear, 32, stdin);
|
||||
if (!(ptr = strchr(&clear, '\n')))
|
||||
return 1;
|
||||
else
|
||||
*ptr = '\0';
|
||||
fgets(&enc, 120, stdin);
|
||||
if (!(ptr = strchr(&enc, '\n')))
|
||||
return 1;
|
||||
else
|
||||
*ptr = '\0';
|
||||
ptr = crypt(clear, enc);
|
||||
if (!strcmp(argv[argc - 1], "-s")) {
|
||||
/* Option -s for "show": output the encrypted version. */
|
||||
printf("%s\n", ptr);
|
||||
return 0;
|
||||
}
|
||||
/* Otherwise this is a check. */
|
||||
else if (!strcmp(ptr, enc))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue