Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!ncar!elroy.jpl.nasa.gov!usc!cs.utexas.edu!asuvax!mcdphx!phx.mcd.mot.com!charles From: charles@phx.mcd.mot.com (Charles Wolff) Newsgroups: comp.unix.questions Subject: question on crypt(3x) routines Message-ID: <14589@mcdphx.phx.mcd.mot.com> Date: 18 Feb 91 17:53:46 GMT Sender: listen@mcdphx.phx.mcd.mot.com Reply-To: charles@phx.mcd.mot.com (Charles Wolff) Distribution: usa Organization: Motorola Microcomputer Division, Tempe, Az. Lines: 40 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