charles@phx.mcd.mot.com (Charles Wolff) (02/19/91)
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
charles@caffeine.UUCP (Charles Wolff) (02/20/91)
In article <14589@mcdphx.phx.mcd.mot.com> charles@phx.mcd.mot.com (Charles Wolff) writes: } }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: } I have already received a VERY helpful reply to this from Mike Oliver at Pyramid, so no need for more follow-ups. Briefly, the 64 character arrays passed to setkey() and encrypt() are "encoded" versions of the binary representations of the characters; for example, if the first character is 'A', then 'A' = 0x41 = 01000001 which leads to: setargs[0] = 0 setargs[1] = 1 setargs[2] = 0 and so on... based on the manual page, I hadn't figured this part of it out, and didn't understand what was supposed to go into the argument arrays to setkey() and encrypt(). Charles Wolff