4 * email: daniel.otte@rub.de
7 * this program generate a lookuptable for the nfsr-feedback-function in grain
13 #define X(i) ((x)>>((i)))
25 uint8_t g(uint16_t x){
29 ret = B60 ^ B52 ^ B45 ^ B37 ^ B33 ^ B28 ^ B21 ^ B09;
30 ret ^= (a = B63 & B60);
31 ret ^= (b = B37 & B33);
33 ret ^= (d = B60 & B52 & B45);
34 ret ^= (e = B33 & B28 & B21);
35 ret ^= B63 & B45 & B28 & B09;
40 ret ^= e & B52 & B45 & B37;
47 uint8_t t, lut[128]={0}; /* 2**10 / 8 == 2**(10-3) == 2**7 == 128 */
50 " * author: Daniel Otte \n"
51 " * email: daniel.otte@rub.de \n"
52 " * license: GPLv3 \n"
54 " * this program generate a lookuptable for the h-function in grain \n"
58 " * b63 b15 b28 b60 b37 b52 b45 b09 b33 b21 - g");
60 for(i=0; i<0x0400; ++i){
62 printf(" * %c %c %c %c %c %c %c %c %c %c - %c\n",
81 printf(" uint8_t g_lut[128]= {");
86 printf("0x%2.2X%c ", lut[i], (i!=127)?',':' ');