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

Subversion Repositories cryptosorter

[/] [cryptosorter/] [trunk/] [memocodeDesignContest2008/] [ctrl/] [gen_test_array.c] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 kfleming
/*
2
Copyright (c) 2008 MIT
3
 
4
Permission is hereby granted, free of charge, to any person
5
obtaining a copy of this software and associated documentation
6
files (the "Software"), to deal in the Software without
7
restriction, including without limitation the rights to use,
8
copy, modify, merge, publish, distribute, sublicense, and/or sell
9
copies of the Software, and to permit persons to whom the
10
Software is furnished to do so, subject to the following
11
conditions:
12
 
13
The above copyright notice and this permission notice shall be
14
included in all copies or substantial portions of the Software.
15
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
OTHER DEALINGS IN THE SOFTWARE.
24
 
25
Author: Kermin Fleming
26
*/
27
#include <stdio.h>
28
#include <assert.h>
29
#include <stdlib.h>
30
#include "aes_core.h"
31
#include "recordio.h"
32
 
33
 
34
 
35
const unsigned char globalkey[] = {0xB0, 0x1D, 0xFA, 0xCE,
36
                                   0x0D, 0xEC, 0x0D, 0xED,
37
                                   0x0B, 0xA1, 0x1A, 0xDE,
38
                                   0x0E, 0xFF, 0xEC, 0x70};
39
 
40
int main() {
41
  long long start, stop;
42
  int i;
43
  FILE *sorted, *unsorted;
44
  assert(sorted = fopen("sorted.hex","w"));
45
  assert(unsorted = fopen("unsorted.hex","w"));
46
 
47
  printf("Initializing database\n");
48
  initializedb(globalkey);
49
 
50
 
51
  printf("Sorting starts\n");
52
  //showdb();
53
  for(i = 0; i < MAXRECORD; i+=1) {
54
    fprintf(unsorted,"%08x%08x%08x%08x\n", db[i].f1,  db[i].f2, db[i].f3,  db[i].f4  );
55
  }
56
 
57
  sortrecord();
58
  //  showdb();
59
  for(i = 0; i < MAXRECORD; i+=1) {
60
    fprintf(sorted,"%08x%08x%08x%08x\n",db[i].f1,  db[i].f2, db[i].f3,  db[i].f4 );
61
  }
62
 
63
 
64
  printf("Verifying results .. (correct = 1): ");
65
  printf("%x\n", verifydb());
66
 
67
  return 0;
68
}
69
 
70
 

powered by: WebSVN 2.1.0

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