Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
mksp.c File Reference
#include <stdio.h>

Go to the source code of this file.

Functions

void makePinv (void)
void makeSP (void)
int main ()
 main()

Variables

unsigned char S [8][64]
unsigned char P [32]
unsigned int Pinv [32]
unsigned int SP [8][64]

Function Documentation

int main ( void  )

main()

Definition at line 154 of file mksp.c.

{
    makePinv();
    makeSP();
    return 0;
}

Here is the call graph for this function:

Definition at line 115 of file mksp.c.

{
    int i;
    unsigned int Pi = 0x80000000;
    for (i = 0; i < 32; ++i) {
       int j = 32 - P[i];
       Pinv[j] = Pi;
       Pi >>= 1;
    }
}

Here is the caller graph for this function:

void makeSP ( void  )

Definition at line 127 of file mksp.c.

{
    int box;
    for (box = 0; box < 8; ++box) {
       int item;
       printf("/* box S%d */ {\n", box + 1);
       for (item = 0; item < 64; ++item ) {
           unsigned int s = S[box][item];
           unsigned int val = 0;
           unsigned int bitnum = (7-box) * 4;
           for (; s; s >>= 1, ++bitnum) {
              if (s & 1) {
                  val |= Pinv[bitnum];
              }
           }
           val = (val << 3) | (val >> 29);
           SP[box][item] = val;
       }
       for (item = 0; item < 64; item += 4) {
           printf("\t0x%08x, 0x%08x, 0x%08x, 0x%08x,\n",
           SP[box][item], SP[box][item+1], SP[box][item+2], SP[box][item+3]);
       }
       printf("    },\n");
    }
}

Here is the caller graph for this function:


Variable Documentation

unsigned char P[32]
Initial value:
 {
       16,   7,  20,  21,  29,  12,  28,  17,
        1,  15,  23,  26,   5,  18,  31,  10,
        2,   8,  24,  14,  32,  27,   3,   9,
       19,  13,  30,   6,  22,  11,   4,  25
}

Definition at line 104 of file mksp.c.

unsigned int Pinv[32]

Definition at line 111 of file mksp.c.

unsigned char S[8][64]

Definition at line 48 of file mksp.c.

unsigned int SP[8][64]

Definition at line 112 of file mksp.c.