#include #include #include #include #include typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; #define ROL_16(x,n) ( ((x) << (n)) | ((x) >> (16-(n))) ) #define ROR_16(x,n) ( ((x) >> (n)) | ((x) << (16-(n))) ) /* bit count is: 31, generated by cformatu.sh */ static const u8 z[31]={1,1,1,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,1,0,0,0,0,1,1,1,0,0,1,1,0}; #define SIMON_M 4 #define SIMON_T 32 void simon3264_keyexpansion(u16 *k) { u16 tmp,tmp2; u32 i; /* The cipher ./bin/simontool.elf -e -b 32 -k 64 -s 0000000000000000 -t 00000000 -l e.txt, and looking in e.txt You can verify this by setting k[0,1,2,3] to zero. */ for ( i=SIMON_M ; i>16; crypt[1]= cword; // printf("words: 0x%04x 0x%04x\n",crypt[0],crypt[1]); for ( i=0 ; i