Annotation of researchv10no/games/des/des.c, revision 1.1

1.1     ! root        1: typedef union {
        !             2:        long words[2];
        !             3:        unsigned char bytes[8];
        !             4: } block;
        !             5: 
        !             6: extern unsigned short ip_L0[],ip_L2[],ip_L4[],ip_L6[] ;
        !             7: extern unsigned short ip_L8[],ip_La[],ip_Lc[],ip_Le[];
        !             8: extern unsigned long ip_L1[],ip_L3[],ip_L5[],ip_L7[] ;
        !             9: extern unsigned long ip_L9[],ip_Lb[],ip_Ld[],ip_Lf[];
        !            10: extern unsigned short ip_H0[],ip_H2[],ip_H4[],ip_H6[] ;
        !            11: extern unsigned short ip_H8[],ip_Ha[],ip_Hc[],ip_He[];
        !            12: extern unsigned long ip_H1[],ip_H3[],ip_H5[],ip_H7[] ;
        !            13: extern unsigned long ip_H9[],ip_Hb[],ip_Hd[],ip_Hf[];
        !            14: extern unsigned long ipi_L0[],ipi_L2[],ipi_L4[],ipi_L6[] ;
        !            15: extern unsigned long ipi_L8[],ipi_La[],ipi_Lc[],ipi_Le[];
        !            16: extern unsigned long ipi_H1[],ipi_H3[],ipi_H5[],ipi_H7[] ;
        !            17: extern unsigned long ipi_H9[],ipi_Hb[],ipi_Hd[],ipi_Hf[];
        !            18: extern long SP0[],SP1[],SP2[],SP3[],SP4[],SP5[],SP6[],SP7[];
        !            19: extern unsigned long E_L0[], E_L5[], E_L6[], E_L7[];
        !            20: extern unsigned short E_L2[], E_L3[], E_L4[];
        !            21: extern unsigned long E_H0[], E_H1[], E_H2[], E_H7[];
        !            22: int shift[] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1};
        !            23: long keys_L[16], keys_H[16];
        !            24: 
        !            25: des(in, out)
        !            26: long in[2], out[2];
        !            27: {
        !            28:        register unsigned long low, high;
        !            29:        register unsigned long temp;
        !            30:        register i;
        !            31:        register unsigned long right, left;
        !            32: 
        !            33:        temp = in[0];
        !            34:        low  = ip_L0[temp & 0xf];
        !            35:        high = ip_H0[temp & 0xf];
        !            36:        temp >>= 4;
        !            37:        low  |= ip_L1[temp & 0xf];
        !            38:        high |= ip_H1[temp & 0xf];
        !            39:        temp >>= 4;
        !            40:        low  |= ip_L2[temp & 0xf];
        !            41:        high |= ip_H2[temp & 0xf];
        !            42:        temp >>= 4;
        !            43:        low  |= ip_L3[temp & 0xf];
        !            44:        high |= ip_H3[temp & 0xf];
        !            45:        temp >>= 4;
        !            46:        low  |= ip_L4[temp & 0xf];
        !            47:        high |= ip_H4[temp & 0xf];
        !            48:        temp >>= 4;
        !            49:        low  |= ip_L5[temp & 0xf];
        !            50:        high |= ip_H5[temp & 0xf];
        !            51:        temp >>= 4;
        !            52:        low  |= ip_L6[temp & 0xf];
        !            53:        high |= ip_H6[temp & 0xf];
        !            54:        temp >>= 4;
        !            55:        low  |= ip_L7[temp & 0xf];
        !            56:        high |= ip_H7[temp & 0xf];
        !            57:        temp = in[1];
        !            58:        low  |= ip_L8[temp & 0xf];
        !            59:        high |= ip_H8[temp & 0xf];
        !            60:        temp >>= 4;
        !            61:        low  |= ip_L9[temp & 0xf];
        !            62:        high |= ip_H9[temp & 0xf];
        !            63:        temp >>= 4;
        !            64:        low  |= ip_La[temp & 0xf];
        !            65:        high |= ip_Ha[temp & 0xf];
        !            66:        temp >>= 4;
        !            67:        low  |= ip_Lb[temp & 0xf];
        !            68:        high |= ip_Hb[temp & 0xf];
        !            69:        temp >>= 4;
        !            70:        low  |= ip_Lc[temp & 0xf];
        !            71:        high |= ip_Hc[temp & 0xf];
        !            72:        temp >>= 4;
        !            73:        low  |= ip_Ld[temp & 0xf];
        !            74:        high |= ip_Hd[temp & 0xf];
        !            75:        temp >>= 4;
        !            76:        low  |= ip_Le[temp & 0xf];
        !            77:        high |= ip_He[temp & 0xf];
        !            78:        temp >>= 4;
        !            79:        low  |= ip_Lf[temp & 0xf];
        !            80:        high |= ip_Hf[temp & 0xf];
        !            81:        left = low;
        !            82:        right = high;
        !            83:        for (i = 0; i < 15; i++) {
        !            84:                temp = right;
        !            85:                low  = E_L0[temp & 0xf];
        !            86:                high = E_H0[temp & 0xf];
        !            87:                temp >>= 4;
        !            88:                high |= E_H1[temp & 0xf];
        !            89:                temp >>= 4;
        !            90:                low  |= E_L2[temp & 0xf];
        !            91:                high |= E_H2[temp & 0xf];
        !            92:                temp >>= 4;
        !            93:                low  |= E_L3[temp & 0xf];
        !            94:                temp >>= 4;
        !            95:                low  |= E_L4[temp & 0xf];
        !            96:                temp >>= 4;
        !            97:                low  |= E_L5[temp & 0xf];
        !            98:                temp >>= 4;
        !            99:                low  |= E_L6[temp & 0xf];
        !           100:                temp >>= 4;
        !           101:                low  |= E_L7[temp & 0xf];
        !           102:                high |= E_H7[temp & 0xf];
        !           103:                low ^= keys_L[i];
        !           104:                high ^= keys_H[i];
        !           105:                temp = SP0[(high >> 16) & 077];
        !           106:                temp |= SP1[(high >> 22) & 077];
        !           107:                temp |= SP2[((low & 03) << 4) | ((high >> 28) & 017)];
        !           108:                temp |= SP3[(low >> 2) & 077];
        !           109:                temp |= SP4[(low >> 8) & 077];
        !           110:                temp |= SP5[(low >> 14) & 077];
        !           111:                temp |= SP6[(low >> 20) & 077];
        !           112:                temp |= SP7[(low >> 26) & 077];
        !           113:                high = left;
        !           114:                left = right;
        !           115:                right = high ^ temp;
        !           116:        }
        !           117:        temp = right;
        !           118:        low  = E_L0[temp & 0xf];
        !           119:        high = E_H0[temp & 0xf];
        !           120:        temp >>= 4;
        !           121:        high |= E_H1[temp & 0xf];
        !           122:        temp >>= 4;
        !           123:        low  |= E_L2[temp & 0xf];
        !           124:        high |= E_H2[temp & 0xf];
        !           125:        temp >>= 4;
        !           126:        low  |= E_L3[temp & 0xf];
        !           127:        temp >>= 4;
        !           128:        low  |= E_L4[temp & 0xf];
        !           129:        temp >>= 4;
        !           130:        low  |= E_L5[temp & 0xf];
        !           131:        temp >>= 4;
        !           132:        low  |= E_L6[temp & 0xf];
        !           133:        temp >>= 4;
        !           134:        low  |= E_L7[temp & 0xf];
        !           135:        high |= E_H7[temp & 0xf];
        !           136:        low ^= keys_L[i];
        !           137:        high ^= keys_H[i];
        !           138:        temp = SP0[(high >> 16) & 077];
        !           139:        temp |= SP1[(high >> 22) & 077];
        !           140:        temp |= SP2[((low & 03) << 4) | ((high >> 28) & 017)];
        !           141:        temp |= SP3[(low >> 2) & 077];
        !           142:        temp |= SP4[(low >> 8) & 077];
        !           143:        temp |= SP5[(low >> 14) & 077];
        !           144:        temp |= SP6[(low >> 20) & 077];
        !           145:        temp |= SP7[(low >> 26) & 077];
        !           146:        left ^= temp;
        !           147:        temp = left;
        !           148:        low  = ipi_L0[temp & 0xf];
        !           149:        temp >>= 4;
        !           150:        high = ipi_H1[temp & 0xf];
        !           151:        temp >>= 4;
        !           152:        low  |= ipi_L2[temp & 0xf];
        !           153:        temp >>= 4;
        !           154:        high |= ipi_H3[temp & 0xf];
        !           155:        temp >>= 4;
        !           156:        low  |= ipi_L4[temp & 0xf];
        !           157:        temp >>= 4;
        !           158:        high |= ipi_H5[temp & 0xf];
        !           159:        temp >>= 4;
        !           160:        low  |= ipi_L6[temp & 0xf];
        !           161:        temp >>= 4;
        !           162:        high |= ipi_H7[temp & 0xf];
        !           163:        temp = right;
        !           164:        low  |= ipi_L8[temp & 0xf];
        !           165:        temp >>= 4;
        !           166:        high |= ipi_H9[temp & 0xf];
        !           167:        temp >>= 4;
        !           168:        low  |= ipi_La[temp & 0xf];
        !           169:        temp >>= 4;
        !           170:        high |= ipi_Hb[temp & 0xf];
        !           171:        temp >>= 4;
        !           172:        low  |= ipi_Lc[temp & 0xf];
        !           173:        temp >>= 4;
        !           174:        high |= ipi_Hd[temp & 0xf];
        !           175:        temp >>= 4;
        !           176:        low  |= ipi_Le[temp & 0xf];
        !           177:        temp >>= 4;
        !           178:        high |= ipi_Hf[temp & 0xf];
        !           179:        out[0] = low;
        !           180:        out[1] = high;
        !           181: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.