URL
https://opencores.org/ocsvn/csa/csa/trunk
Subversion Repositories csa
[/] [csa/] [trunk/] [sw_sim/] [get_key_perm_table.c] - Rev 36
Go to most recent revision | Compare with Previous | Blame | View Log
/* * this alone program generate the partical code for key_perm.v */ #include <stdio.h> #include <string.h> #include <memory.h> #include <assert.h> unsigned char key_perm[0x40] = { 0x12,0x24,0x09,0x07,0x2A,0x31,0x1D,0x15,0x1C,0x36,0x3E,0x32,0x13,0x21,0x3B,0x40, 0x18,0x14,0x25,0x27,0x02,0x35,0x1B,0x01,0x22,0x04,0x0D,0x0E,0x39,0x28,0x1A,0x29, 0x33,0x23,0x34,0x0C,0x16,0x30,0x1E,0x3A,0x2D,0x1F,0x08,0x19,0x17,0x2F,0x3D,0x11, 0x3C,0x05,0x38,0x2B,0x0B,0x06,0x0A,0x2C,0x20,0x3F,0x2E,0x0F,0x03,0x26,0x10,0x37, }; unsigned char unkey_perm[0x40]; #define RI(i) ((i)/8*8+(7-((i)%8))) int main() { int i; int n; int sp; int tp; memset(unkey_perm,0,sizeof unkey_perm); for(i=0;i<64;i++) { for(n=0;n<64;n++) { if(key_perm[n]==RI(i)+1) break; } assert(n<64); n=RI(n); unkey_perm[i]=n; } for (i=63;i>=0;i--) { printf("i_key[6\'h%02x]", unkey_perm[i]); printf(","); if((i%4)==0) printf("\n"); } return 0; }
Go to most recent revision | Compare with Previous | Blame | View Log