des_soft.c revision 26219
126219Swpaul#if !defined(lint) && defined(SCCSIDS) 226219Swpaulstatic char sccsid[] = "@(#)des_soft.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI"; 326219Swpaul#endif 426219Swpaul/* 526219Swpaul * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 626219Swpaul * unrestricted use provided that this legend is included on all tape 726219Swpaul * media and as a part of the software program in whole or part. Users 826219Swpaul * may copy or modify Sun RPC without charge, but are not authorized 926219Swpaul * to license or distribute it to anyone else except as part of a product or 1026219Swpaul * program developed by the user. 1126219Swpaul * 1226219Swpaul * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1326219Swpaul * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 1426219Swpaul * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1526219Swpaul * 1626219Swpaul * Sun RPC is provided with no support and without any obligation on the 1726219Swpaul * part of Sun Microsystems, Inc. to assist in its use, correction, 1826219Swpaul * modification or enhancement. 1926219Swpaul * 2026219Swpaul * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 2126219Swpaul * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 2226219Swpaul * OR ANY PART THEREOF. 2326219Swpaul * 2426219Swpaul * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2526219Swpaul * or profits or other special, indirect and consequential damages, even if 2626219Swpaul * Sun has been advised of the possibility of such damages. 2726219Swpaul * 2826219Swpaul * Sun Microsystems, Inc. 2926219Swpaul * 2550 Garcia Avenue 3026219Swpaul * Mountain View, California 94043 3126219Swpaul */ 3226219Swpaul/* 3326219Swpaul * Table giving odd parity in the low bit for ASCII characters 3426219Swpaul */ 3526219Swpaulstatic char partab[128] = { 3626219Swpaul 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x07, 0x07, 3726219Swpaul 0x08, 0x08, 0x0b, 0x0b, 0x0d, 0x0d, 0x0e, 0x0e, 3826219Swpaul 0x10, 0x10, 0x13, 0x13, 0x15, 0x15, 0x16, 0x16, 3926219Swpaul 0x19, 0x19, 0x1a, 0x1a, 0x1c, 0x1c, 0x1f, 0x1f, 4026219Swpaul 0x20, 0x20, 0x23, 0x23, 0x25, 0x25, 0x26, 0x26, 4126219Swpaul 0x29, 0x29, 0x2a, 0x2a, 0x2c, 0x2c, 0x2f, 0x2f, 4226219Swpaul 0x31, 0x31, 0x32, 0x32, 0x34, 0x34, 0x37, 0x37, 4326219Swpaul 0x38, 0x38, 0x3b, 0x3b, 0x3d, 0x3d, 0x3e, 0x3e, 4426219Swpaul 0x40, 0x40, 0x43, 0x43, 0x45, 0x45, 0x46, 0x46, 4526219Swpaul 0x49, 0x49, 0x4a, 0x4a, 0x4c, 0x4c, 0x4f, 0x4f, 4626219Swpaul 0x51, 0x51, 0x52, 0x52, 0x54, 0x54, 0x57, 0x57, 4726219Swpaul 0x58, 0x58, 0x5b, 0x5b, 0x5d, 0x5d, 0x5e, 0x5e, 4826219Swpaul 0x61, 0x61, 0x62, 0x62, 0x64, 0x64, 0x67, 0x67, 4926219Swpaul 0x68, 0x68, 0x6b, 0x6b, 0x6d, 0x6d, 0x6e, 0x6e, 5026219Swpaul 0x70, 0x70, 0x73, 0x73, 0x75, 0x75, 0x76, 0x76, 5126219Swpaul 0x79, 0x79, 0x7a, 0x7a, 0x7c, 0x7c, 0x7f, 0x7f, 5226219Swpaul}; 5326219Swpaul 5426219Swpaul/* 5526219Swpaul * Add odd parity to low bit of 8 byte key 5626219Swpaul */ 5726219Swpaulvoid 5826219Swpauldes_setparity(p) 5926219Swpaul char *p; 6026219Swpaul{ 6126219Swpaul int i; 6226219Swpaul 6326219Swpaul for (i = 0; i < 8; i++) { 6426219Swpaul *p = partab[*p & 0x7f]; 6526219Swpaul p++; 6626219Swpaul } 6726219Swpaul} 68