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

Subversion Repositories csa

[/] [csa/] [trunk/] [sw_sim/] [key_schedule.c] - Blame information for rev 38

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

Line No. Rev Author Line
1 13 simon111
/* this file simulates the key_schedule funtion */
2
 
3
#include <stdio.h>
4
#include <string.h>
5
 
6
extern void key_schedule(unsigned char *CK, int *kk) ;
7
 
8
int main()
9
{
10
        unsigned char CK[8];
11
        int           kk[57];
12
        int           i;
13
        int           c;
14
 
15
        memset(CK,0,sizeof CK);
16
        for (i=63;i>=0;i--)
17
        {
18
             c=getchar();
19 15 simon111
#ifdef DEBUG
20 13 simon111
             printf("%c",c);
21 15 simon111
#endif
22 13 simon111
             if(c=='1')
23
             {
24
                     CK[i/8]|=(1<<(i%8));
25
             }
26
        }
27 15 simon111
#ifdef DEBUG
28
             printf("\n");
29
#endif
30 13 simon111
        memset(kk,0,sizeof kk);
31
        key_schedule(CK,kk);
32 15 simon111
        for(i=57*8-1;i>=8;i--)
33 13 simon111
        {
34
                if(kk[i/8]&(1<<(i%8)))
35
                        printf("1");
36
                else
37
                        printf("0");
38
        }
39 15 simon111
        printf("\n");
40 13 simon111
        return 0;
41
}

powered by: WebSVN 2.1.0

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