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

Subversion Repositories nfcc

[/] [nfcc/] [trunk/] [rijndael/] [invcipher/] [visual.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arif_endro
#include <stdio.h>
2
 
3
#define st 4
4
#define nb 4
5
#define nR 10
6
main(int argc, char *argv[])
7
{
8
        int r,i,j,v,nr;
9
//      char state[st][4]= {"ad", "sb", "sr", "mx"};
10
        char state[st][20]= {"AddRoundKey", "SubBytes", "ShiftRows", "MixColumns"};
11
 
12
        nr = nR;
13
        if (argc > 1 ) sscanf(argv[1], "%d", &nr);
14
 
15
//      printf("%3s -- %3s -- %3s \n", "Seq", "Fwd", "Inv");
16
 
17
        r = 0; // initial round equal 0
18
        v = nr+1; // total there is nr+1 operation
19
        for ( j = 0; j < nr + 1; j ++) {
20
                for (i = 0; i < st; i++) {
21
                        if (i == 1) r++;
22
                        if (i == 3) v--;
23
                        if ( !((j == nr) && (i == 3)))
24
                                printf("%3d -- %3d(0x%x) -- %3d -- %11s -- %3d -- %3d(0x%x) -- %3d\n", j, r, r, i, state[i],   3-i, v, v, nr-j);
25
                        else
26
                                printf("%3d -- %3d(0x%x) -- %3d -- %11s -- %3d -- %3d(0x%x) -- %3d\n", j, r, r, i, state[i-3], 3-i, v, v, nr-j);
27
                }
28
        }
29
}

powered by: WebSVN 2.1.0

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