OpenCores
URL https://opencores.org/ocsvn/csa/csa/trunk

Subversion Repositories csa

[/] [csa/] [trunk/] [sw_sim/] [key_schedule.c] - Rev 32

Go to most recent revision | Compare with Previous | Blame | View Log

/* this file simulates the key_schedule funtion */
 
#include <stdio.h>
#include <string.h>
 
extern void key_schedule(unsigned char *CK, int *kk) ;
 
int main()
{
        unsigned char CK[8];
        int           kk[57];
        int           i;
        int           c;
 
        memset(CK,0,sizeof CK);
        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);
        for(i=57*8-1;i>=8;i--)
        {
                if(kk[i/8]&(1<<(i%8)))
                        printf("1");
                else
                        printf("0");
        }
        printf("\n");
        return 0;
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.