//----------------------------------------------------------------------------
//
//  ise_test_3.cpp
//
//  Authors: Joe Jarchow, Geoffrey Griffith, Joseph Kadhim, Shinya Daigaku
//           Andrew Pouzeshi
//
//  Sponsor: Tom Lookabaugh, Assistant Professor of Computer Science
//           University of Colorado
//
//  Senior Project: Team ISE (Image Selective Encryption)
//----------------------------------------------------------------------------


// This file is designed to test the ISE production code with test3.sh

#include <stdlib.h>     
#include <iostream>
#include <fstream> 
#include <string>
#include "rijndael-api-fst.h"
#include "ise.h"

using namespace std;

int main(int argc, char * argv[])
{
    /* Set_Key Function with Valid Key */

    size_t length = 0;
    int err = 0;
    char MyKey [] = "enterthekey";

    /* Call the constructor with only the key */
    jpeg_ise decrypt_test(MyKey);
    
    /* loop through 10000 keys */
    length = 32;
    char * test_key;  
    test_key = new char[length + 1];
    int imod = 0;
    strcpy (test_key,"00000000000000000000000000000000");
    for (int i = 0; i < 32; i++)
    {
      test_key[i] = (char) 0;
    }
    for (int i = 0; i < 8160; i++)
    {
        err = decrypt_test.set_key(test_key);
        if (err != 0) cout << "set_key() failed for key " << test_key << endl;
	imod = i%32;
	test_key[imod] = (char)((unsigned int)test_key[imod] + 1);
    }
    delete [] test_key;
    return 0;
}
