I've tried using this code:
char k[2];
char str[255];
scanf("%s",k);
scanf("%s",str);
printf("%s\n",crypt(str,k));
Entering only 1 character to k variable I verify that encrypted string begins with key character repeated twice.
Tested on Solaris and HP-UX SO.
The previous test was executed on Mac OS Linux environment, maybe there are some little differences in gcc and/or libcrypto libraries.
However, it seems I can change the password in unattended mode using a C pgm tha returns the encrypted pwd because I also verified that both the encrypted pwds returned by C pgm and passwd command are the same.
So many thanks, Collins, for your help
.
Bye
nisant