Annotation of researchv10no/cmd/descrypt/des.c, revision 1.1

1.1     ! root        1: /*
        !             2:  *     Data Encryption Standard (DES) Layer
        !             3:  *     D.P.Mitchell  83/06/08.
        !             4:  */
        !             5: 
        !             6: #include "crypt.h"
        !             7: 
        !             8: extern long s0p[],s1p[],s2p[],s3p[],s4p[],s5p[],s6p[],s7p[];
        !             9: extern int subkeys[];
        !            10: 
        !            11: des(block)
        !            12: Block *block;
        !            13: {
        !            14:        register long crypto, temp;
        !            15:        register int *key;
        !            16:        register round;
        !            17:        register long right, left;
        !            18: 
        !            19:        left = block->left;
        !            20:        right = block->right;
        !            21:        key = subkeys;
        !            22:        for (round = 0; round < 16; round++) {
        !            23:                temp = (right << 1) | ((right >> 31) & 1);
        !            24:                crypto  = s0p[(temp & 0x3f) ^ *key++];
        !            25:                crypto |= s1p[((temp & 0x3f0) >> 4) ^ *key++];
        !            26:                crypto |= s2p[((temp & 0x3f00) >> 8) ^ *key++];
        !            27:                crypto |= s3p[((temp & 0x3f000) >> 12) ^ *key++];
        !            28:                crypto |= s4p[((temp & 0x3f0000) >> 16) ^ *key++];
        !            29:                crypto |= s5p[((temp & 0x3f00000) >> 20) ^ *key++];
        !            30:                crypto |= s6p[((temp & 0x3f000000) >> 24) ^ *key++];
        !            31:                temp = ((right & 1) << 5) | ((right >> 27) & 0x1f);
        !            32:                crypto |= s7p[temp ^ *key++];
        !            33:                if (round == 15)
        !            34:                        left ^= crypto;
        !            35:                else {
        !            36:                        temp = left;
        !            37:                        left = right;
        !            38:                        right = temp ^ crypto;
        !            39:                }
        !            40:        }
        !            41:        block->left = left;
        !            42:        block->right = right;
        !            43: }

unix.superglobalmegacorp.com

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