Annotation of researchv10no/cmd/descrypt/crunch.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     Hash User's Ascii Key into 1024 Bits with DES in CBC Mode
                      3:  *     D.P.Mitchell  83/05/24.
                      4:  */
                      5: 
                      6: #include "crypt.h"
                      7: #define KEY (*kstring ? (*kstring++ & 0377) : 0)
                      8: 
                      9: Block xkey[SUPERSIZE];
                     10: 
                     11: Block
                     12: key_crunch(kstring)
                     13: char *kstring;
                     14: {
                     15:        register n;
                     16:        Block hashkey;
                     17: 
                     18:        hashkey.right = 0x4f7b0289;
                     19:        hashkey.left  = 0x25da0a19;
                     20:        key_setup(&hashkey, 0);
                     21:        xkey[0].left  = 0;
                     22:        xkey[0].right = 0;
                     23:        for (n = 0; n < SUPERSIZE; n++) {
                     24:                xkey[n].left  ^= KEY << 0;
                     25:                xkey[n].left  ^= KEY << 8;
                     26:                xkey[n].left  ^= KEY << 16;
                     27:                xkey[n].left  ^= KEY << 24;
                     28:                xkey[n].right ^= KEY << 0;
                     29:                xkey[n].right ^= KEY << 8;
                     30:                xkey[n].right ^= KEY << 16;
                     31:                xkey[n].right ^= KEY << 24;
                     32:                des(&xkey[n]);
                     33:                if (n < SUPERSIZE - 1)
                     34:                        xkey[n+1] = xkey[n];
                     35:        }
                     36:        return xkey[SUPERSIZE - 1];
                     37: }
                     38: 
                     39: Block
                     40: recrunch()
                     41: {
                     42:        register m, n;
                     43: 
                     44:        for (n = 0; n < SUPERSIZE; n++) {
                     45:                m = (n + SUPERSIZE - 1) % SUPERSIZE;
                     46:                xkey[n].left  ^= xkey[m].left;
                     47:                xkey[n].right ^= xkey[m].right;
                     48:                des(&xkey[n]);
                     49:        }
                     50:        return xkey[SUPERSIZE - 1];
                     51: }

unix.superglobalmegacorp.com

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