X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=grain_h_lutgen.c;fp=grain_h_lutgen.c;h=0000000000000000000000000000000000000000;hb=6bca96e560e6097aa5b225fad67f2e2a27f4182f;hp=4b5ede074a157d3d52eb0a3cb21895314829fe7e;hpb=96ebafd201c9e8441c7677577b24aa402c1defc6;p=avr-crypto-lib.git diff --git a/grain_h_lutgen.c b/grain_h_lutgen.c deleted file mode 100644 index 4b5ede0..0000000 --- a/grain_h_lutgen.c +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * author: Daniel Otte - * email: daniel.otte@rub.de - * license: GPLv3 - * - * this program generate a lookuptable for the h-function in grain - */ - -#include -#include - -#define X(i) ((x)>>((i))) -uint8_t h(uint8_t x){ - uint8_t h; - - h = (X(1)) ^ (X(4)) ^ - (X(0)&X(3)) ^ (X(2)&X(3)) ^ (X(3)&X(4)) ^ - (X(0)&X(1)&X(2)) ^ (X(0)&X(2)&X(3)) ^ (X(0)&X(2)&X(4)) ^ - (X(1)&X(2)&X(4)) ^ (X(2)&X(3)&X(4)) ; - - return h&1; -} - -int main(void){ - uint8_t i; - uint32_t lut; - puts( - "/* \n" - " * author: Daniel Otte \n" - " * email: daniel.otte@rub.de \n" - " * license: GPLv3 \n" - " * \n" - " * this program generate a lookuptable for the h-function in grain \n" - " * \n" - " */ \n"); - puts("/* \n" - " * x0 x1 x2 x3 x4 - h"); - - for(i=0; i<0x20; ++i){ - printf(" * %c %c %c %c %c - %c\n", - (i&0x01)?'1':'0', - (i&0x02)?'1':'0', - (i&0x04)?'1':'0', - (i&0x08)?'1':'0', - (i&0x10)?'1':'0', - (h(i))?'1':'0' ); - lut >>=1; - lut |= h(i)?0x80000000:0x00000000; - if(i%4==3){ - puts(" * --"); - } - } - puts(" */\n"); - printf(" uint8_t lut[4]= {0x%2.2X, 0x%2.2X, 0x%2.2X, 0x%2.2X} \n", - lut&0xFF, (lut>>8)&0xFF, (lut>>16)&0xFF, (lut>>24)&0xFF); - - return 0; -} -