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

1.1     ! root        1: extern int shift[];
        !             2: extern long keys_L[], keys_H[];
        !             3: extern long PC1[], PC2[];
        !             4: 
        !             5: compkeys(key, rev)
        !             6: long key[2];
        !             7: int rev;
        !             8: {
        !             9:        register long low, high;
        !            10:        register long lowkey, highkey;
        !            11:        register long i, j;
        !            12:        int iiiii;
        !            13:        int carry1, carry2, carry3;
        !            14: 
        !            15:        low = 0;
        !            16:        high = 0;
        !            17:        for (i = 0, j = key[1]; i < 64; i += 2) {
        !            18:                if (j < 0) {
        !            19:                        low |= PC1[i];
        !            20:                        high |= PC1[i + 1];
        !            21:                }
        !            22:                j += j;
        !            23:        }
        !            24:        for (j = key[0]; i < 128; i += 2) {
        !            25:                if (j < 0) {
        !            26:                        low |= PC1[i];
        !            27:                        high |= PC1[i + 1];
        !            28:                }
        !            29:                j += j;
        !            30:        }
        !            31:        for (iiiii = 0; iiiii < 16; iiiii++) {
        !            32:                for (j = 0; j < shift[iiiii]; j++) {
        !            33:                        carry1 = 0;
        !            34:                        carry2 = 0;
        !            35:                        carry3 = 0;
        !            36:                        if (low < 0)
        !            37:                                carry1 = 020;
        !            38:                        if (low & 010)
        !            39:                                carry2 = 0400;
        !            40:                        if (high < 0)
        !            41:                                carry3 = 1;
        !            42:                        low <<= 1;
        !            43:                        low &= ~020;
        !            44:                        low |= carry1;
        !            45:                        low |= carry3;
        !            46:                        high <<= 1;
        !            47:                        high |= carry2;
        !            48:                }
        !            49:                lowkey = 0;
        !            50:                highkey = 0;
        !            51:                for (i = 0, j = high; i < 64; i += 2) {
        !            52:                        if (j < 0) {
        !            53:                                lowkey |= PC2[i];
        !            54:                                highkey |= PC2[i + 1];
        !            55:                        }
        !            56:                        j += j;
        !            57:                }
        !            58:                for (j = low; i < 128; i += 2) {
        !            59:                        if (j < 0) {
        !            60:                                lowkey |= PC2[i];
        !            61:                                highkey |= PC2[i + 1];
        !            62:                        }
        !            63:                        j += j;
        !            64:                }
        !            65:                if (rev) {
        !            66:                        keys_L[15 - iiiii] = lowkey;
        !            67:                        keys_H[15 - iiiii] = highkey;
        !            68:                } else {
        !            69:                        keys_L[iiiii] = lowkey;
        !            70:                        keys_H[iiiii] = highkey;
        !            71:                }
        !            72:        }
        !            73: }

unix.superglobalmegacorp.com

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