Strange issue utilizing encrypt() in libcrypt
Hello everybody, it's my first post here :)
First of all I'd like to thank the entire board and cprogramming.com for solving so many of my problems with C.
Now, as for my problem:
I've been asked to use the encrypt function included in lybcrypt (I have to link it while compiling with -lcrypt) to encrypt some data. I've watched the documentation and everything is clear, but even with the example written there I encouter a strange issue. In order:
I set the key for the encryption in key[64]
I set the txt[64] with the characters to encrypt
I print txt and everything is ok
I set the key with setkey(key)
I encrypt txt with encrypt(txt, 0)
I print txt and nothing is printed, which I guess is ok because of the encrypt function
I de-encrypt txt with encrypt(txt, 1)
I print txt... and I get the correct length but no chars, only white spaces (' ')
What could it be? Does it have something to do with the key?