J
Janni Jensen
Dear readers,
I would like to learn to use libcrypt on Linux, but when I execute this
program, it prints nothing.
I compile like so:
gcc -Wall -lcrypt crypt.c -o crypt
It ought to crypt "mysecrettext" with the key "mykey" and decrypt again
and finally print the result to the screen. But it doesn't=(
Can anyone help me?
Lots of love,
Janni
#include <crypt.h>
#include <stdio.h>
#include <string.h>
int main() {
char key[64] = "mykey"; /* bit pattern for key */
char txt[64] = "mysecrettext"; /* bit pattern for messages */
setkey(key);
encrypt(txt, 0); /* encode */
encrypt(txt, 1); /* decode */
printf("%s", txt);
return(0);
}
I would like to learn to use libcrypt on Linux, but when I execute this
program, it prints nothing.
I compile like so:
gcc -Wall -lcrypt crypt.c -o crypt
It ought to crypt "mysecrettext" with the key "mykey" and decrypt again
and finally print the result to the screen. But it doesn't=(
Can anyone help me?
Lots of love,
Janni
#include <crypt.h>
#include <stdio.h>
#include <string.h>
int main() {
char key[64] = "mykey"; /* bit pattern for key */
char txt[64] = "mysecrettext"; /* bit pattern for messages */
setkey(key);
encrypt(txt, 0); /* encode */
encrypt(txt, 1); /* decode */
printf("%s", txt);
return(0);
}