URL
https://opencores.org/ocsvn/csa/csa/trunk
[/] [csa/] [trunk/] [sw_sim/] [key_schedule.c] - Diff between revs 24 and 48
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 24 |
Rev 48 |
Line 1... |
Line 1... |
/* this file simulates the key_schedule funtion */
|
/* this file simulates the key_schedule funtion */
|
|
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <string.h>
|
#include <string.h>
|
|
#include "misc.h"
|
|
|
extern void key_schedule(unsigned char *CK, int *kk) ;
|
extern void key_schedule(unsigned char *CK, int *kk) ;
|
|
|
int main()
|
int main()
|
{
|
{
|
unsigned char CK[8];
|
unsigned char CK[8];
|
int kk[57];
|
int kk[57];
|
int i;
|
|
int c;
|
|
|
|
memset(CK,0,sizeof CK);
|
READ_DATA(CK,8);
|
for (i=63;i>=0;i--)
|
|
{
|
|
c=getchar();
|
|
#ifdef DEBUG
|
|
printf("%c",c);
|
|
#endif
|
|
if(c=='1')
|
|
{
|
|
CK[i/8]|=(1<<(i%8));
|
|
}
|
|
}
|
|
#ifdef DEBUG
|
|
printf("\n");
|
|
#endif
|
|
memset(kk,0,sizeof kk);
|
|
key_schedule(CK,kk);
|
key_schedule(CK,kk);
|
for(i=57*8-1;i>=8;i--)
|
|
|
/*WRITE_DATA(&(kk[1]),56);*/ /* note: can not write this array once in here*/
|
{
|
{
|
if(kk[i/8]&(1<<(i%8)))
|
int i ;
|
printf("1");
|
for(i=0;i<56;i++)
|
else
|
WRITE_DATA(&kk[1+i],1);
|
printf("0");
|
|
}
|
}
|
printf("\n");
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.