question on crypt(3x) routines

Charles Wolff charles at phx.mcd.mot.com
Tue Feb 19 04:53:46 AEST 1991


Can anyone either provide a response to the following or
point me toward a more appropriate newsgroup?

I am looking at the "crypt(3X)" routines "setkey()" and "encrypt()",
in SysV Rel 3.2, and it's not clear to me how they're supposed to be
used.  The manual page says:

"The argument of setkey is a character array of length 64
containing only the characters with the numerical value 0
and 1."  I take this to mean:

	char setargs[64];

	for (i=0;i<64;i++)
	  setargs[i] = ( i % 1 );  /* sets setargs to 0,1,0,1,0...) */

	setkey(setargs);

"The argument to the encrypt entry is a character array of length
64 containing only the characters with numerical value 0 and 1."

	where the synopsis is "void encrypt (block, edflag)"
	and "block" is a char *.

(edflag: 0 means encrypt, 1 means decrypt.  That's clear.)

I'm confused.  I would think that "block[]" should be an array of
text characters that are to be encrypted, not an array of (char) 0
and (char) 1 values.  If not, how do you pass text to encrypt() to
be encrypted, or is that not what one does?  Am I even more
confused than I thought?

Can anybody provide a brief example of the use of setkey() and
encrypt(), along with sample output that I can use to tell if my
system has implemented it correctly?

Thanks,

Charles Wolff



More information about the Comp.unix.questions mailing list