How to use libcrypt ?

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);
}
 
J

Jack Klein

J

Janni Jensen

Non-standard libraries that are not defined by the C standard are
off-topic here. Linux programming questions should be asked in
news:comp.os.linux.development.apps.

Thanks=)

Hugs,
Janni
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,125
Messages
2,570,748
Members
47,302
Latest member
MitziWragg

Latest Threads

Top