By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

How to use libcrypt ?

P: n/a
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);
}

Nov 14 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 30 Dec 2003 01:52:41 +0100, Janni Jensen
<d_e_l_e_t_e_janni@t_h_i_s_elvis.com> wrote in comp.lang.c:
Dear readers,

I would like to learn to use libcrypt on Linux, but when I execute this
program, it prints nothing.


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.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 14 '05 #2

P: n/a
> 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

Nov 14 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.