Sunday, October 30, 2016

ALGORITHM THAT MAKES ALL INFORMATION WITH-IN SPACE-TIME PUBLIC KNOWLEDGE INVENTED!!!!

COPYRIGHT (C) 2016 http://time-travel.institute

At https://sourceforge.net/projects/timetravelproject/ 

you will find my latest code for my public version of my throttled binary counter. I am cleaning it up and making it faster. Instead of re-writing my post I made at Sourceforge I will re-quote my post I made over there.

Fire codes is finished and I finished up one of the most powerful algorithms there is for decrypting just about anything. It is called a throttled binary counter. This decryption algorithm basically makes ALL INFORMATION PUBLIC KNOWLEDGE. 

I am cleaning up the code and tweaking it and making it faster. Next I am writing code that will plot unknown time travel computer media files on a X,Y chart with a regression line. It will calculate an equation that finds the strong check sums on the y axis and the weak check sums on the x axis. It will calculate these check sums then put them into my decryption algorithms to decrypt time travel computer media files out of the past, present, future, and alternate time lines as a method of time travel. It will make these check sums that are calculated into real computer media files existing on the hard drive.

Ray Hudson, Darby Phillips, and Pamela have failed to stop me. These people I have labeled "The Conspiracy Against Time Travel".

Here is my traffic for the week. My blog is not always open so this does not represent all the traffic this blog can get.


United States 60 (Most of this is probably blog author traffic)
France 9
Canada 6
Jordan 3
Russia 3
Ukraine 3
Belgium 2
China 2
Indonesia 1
Poland 1

I am sorry Pamela for making my blog longer. I hope you will be ok. Pamela likes to bitch about how long my blog is. She said my blog makes her want to bang her head against the wall. 
----------------------------------------------------------------------------

Well the counter I previously posted is not the same any more. But, I have not had a chance to repost it and may not get a chance until next week some time.

How I finally did it is I went back to my old method of getting a strong check sum before the counter rolled and a strong check sum after the counter rolled. If the destination sum was closer to the target after the counter rolled I kept the counter. If not I reloaded the previous counter.

Now, after that I vary the speed of the counter from slow to fast. That knocked the counter damn close to its target sum. Then, tweak each byte in the counter up and down. After I got the strong sum before the tweak and the strong sum after the tweak. If the strong sum after the tweak was closer to the target I kept the counter. If not I reloaded my previous counter. I never let the counter roll where the strong sum is farther away from the destination sum after the roll. I let the destination sum get closer to its strong sum or stay the same. That is the secret to a damn fast decryption counter. I call it a throttled binary counter using the "BURRIS COUNTER ALGORITHM".

When the destination sum equaled the target sum the counter was finished and a computer media file was reconstructed. I did not use the weak check sum In this counter. I thought about it but decided against it.

I have more leeway and freedom with algorithms just using the strong sum only.

I have already got Fire Codes and Time Travel Project (both those at sourceforge.net

https://sourceforge.net/projects/firecodes/
https://sourceforge.net/projects/timetravelproject/
)

Damn near where they need to be to time hack. Darby Phillips and Ray Hudson should be about ready to bawl and cry now.

I did some research on youtube on the CIA which Ray Hudson and Darby Phillips belong too. It seems the CIA was really big into time travel a while back even running several time travel projects. It gets clearer to me all the time why they are watching me, harassing me, and stalking me.

They can't hide this shit from society forever. I was watching youtube today and I realized that before the advent of tv and computers people did not see stuff hardly like time travel, ghost, ufo's and big foot.

At least not most people. Now anyone can get on YouTube and watch real videos of ghost caught on camera attacking people, they can watch real videos of UFO's. Hell, they can even watch big foot videos but the jury is still out on most of those big foot videos.

What chaps my ass is Ray Hudson, Darby Phillips, and Pamela don't go around harassing people that talk about UFO's, ghost, and big foot but let me go into a damn forum and start talking about my method of time travel and all hell breaks loose. Then my thread gets deleted and I get banned. That is bull shit.

Now, if people can see this ghost, ufo, and big foot shit on you tube I am pretty sure that when I am done with the public version of my time travel program people will be able to download my code and run it and if I am correct PEOPLE WILL BE UPLOADING AND WATCHING VIDEOS OF TIME TRAVEL COMPUTER MEDIA ON YOUTUBE!!!!!!!!!!!

GOD DAMN THE CIA, NSA, AND MAJESTIC TWELVE WILL LOVE THAT SHIT!!!

BAAAAAAAAAAAAAAAAAAAAHAHAHAHAHAHAHAH!!!!!

BAAAAAAAAAAAAAAAAAAAAHAHAHAHAHAHAHAH!!!!!

BAAAAAAAAAAAAAAAAAAAAHAHAHAHAHAHAHAH!!!!!

BAAAAAAAAAAAAAAAAAAAAHAHAHAHAHAHAHAH!!!!!

Oh god I got tears in my eyes now. My stomach is hurting. I had better calm the hell down and get off here.

I get my public version of my time travel computer code working I may super charge You Tube. To bad I did not get my public version of my time travel code posted on sourceforge.net years earlier.

If I had of Oh Donald Trump would be running my time travel computer code about right now trying to reconstruct Hilary Clinton's emails so he can turn them over to the FBI.

BAAAAAAAAAAAAAAAHAHAHAHAHAHAHA!!!!!!!!!!!!!!!! 
I got to stop cracking myself up before I hurt myself.

I sure hope that man wins the white house. I am rooting for him.

As always I will keep everyone posted. But, I will say this before I go. My Time Travel Project and Fire Codes at sourceforge.net are a sure thing. Fire Codes is already running. It runs best in parallel. But when the public version Time Travel Project is finished shit is going to hit the fan.

I sure hope Darby and Ray is in front of the fan when that happens. Hahahahahaha....................

Sorry Pamela, I made my blog longer again. Your head should be hurting pretty damn bad by now.  Bye.... Hahahahahahahah...........
-------------------------------------------------------------------------------

Well today I have been thinking about what improvements I will make to Time Travel Project at Sourceforge.net. One improvement I might make later on is having the check sums done by hand in the program the way a human would do it. And have the answer written out to one long file. That way there is no digits lost. It will be with one hundred percent precision for accuracy. Then when the programs runs it will have to use files to compare target and destination check sums. I have this in my private code.

I spent 8 years written my private code. My private time travel code is the and I say "The NSA and CIA's dream come true for an intelligence gathering tool or their worst night mare for an intelligence gathering tool being in public hands".

But, they have no fear my private code stays private. But, I am giving the public their own. Then the public can take it and develop it has they please.

Wednesday through Sunday I will be working on Time Travel Project. I got to get its counter up to production speed then work on the rest. I have been doing the planning for the rest of it so I am kinda working on the whole thing at once.

---------------------------------------------------------------------------------
HERE IS THE PROGRAM OUTLINE FOR THE COUNTER FOR TIME TRAVEL PROJECT. I HAVE DONE SOME INITIAL TESTING AND I AM REWRITING AND FINALIZING THE CODE. IT IS SUBJECT TO CHANGE. THE CONSPIRACY AGAINST TIME TRAVEL HAVE FAILED!!!!!!!!!!!!!!!

COUNTER6.CPP PROGRAM OUTLINE. HEY RAY HUDSON. YOU NEVER TOLD ME I COULD NOT POST MY CODE OUTLINES!!! HAHAHAHA..........................

#include cstdlib
#include iostream
#include stdlib.h
#include fstream
#include sstream
#include string 
#include cmath
#include ctime
#include cstdio
#include iostream
#include /home/reactor1967/mersennetwister.h // This is a dependancy. I MIGHT NOT USE THIS IN THE FINAL PROGRAM. ITS OUTDATED

using namespace std;

// declare subs

    // declare global array counter

// check if test = 1

    // declare global array speed

// check if test = 1

    // declare global array backup

// check if test = 1

    // declare global array weights

// check if test = 1

    // add speed array to counter array

// check if test = 1

    // get size of file

// check if test = 1

    // get weak sum of file

// check if test = 1

    // get weak sum of array

// check if test = 1

    // get strong check sum of file

// check if test = 1

    // get strong check sum of array

// check if test = 1

    // randomly set speed of speed array

// check if test = 1

    // linearly set speed of array

// check if test = 1

    // tweak counter in linear mode

// check if test = 1

    // tweak counter in random mode

// check if test = 1

    // restore counter array

// check if test = 1

    // backup counter array

// check if test = 1

    // Create random number file using the Burris Algorithm
         // get a random weak sum for a specific file size using pseudo random number generator
         // randomly create file that specific size
         // randomly bring file to weak sum
         // implement RAY HUDSONS TOSS SALAD ALGORITM.

// check if test = 1

    // Load project from config file

// check if test = 1

// Start main    

    // Declare variabes 

       // set count for tweak to -1

       // set count for counter to -1

       // set count for speed to -1

       // if testing program for debugging set test to 1 to display checks else set test to 0

       // set mode for counter speed for linear or random or none

       // set mode for tweak counter for linear or random or none

    // parse command line arguments (choice parameters) 

    // If arguments skip to jump (THIS IS FOR RUNNING IN PARALLEL!!!!!!!!!!!!!!!!!) WHEN PROGRAM IS FINISHED.

// check if test = 1

    // get name of file from user

// check if test = 1

    // ask user if this is a config file yes or no

// check if test = 1

    // if config file goto jump

// check if test = 1

    // ask how many weights to use for strong check sum

// check if test = 1

    // jump point here if ran from command line

// if this is a config file load config file

// check if test = 1

    // Generate weights in array

// check if test = 1

    // Bubble sort weights

// check if test = 1

    // initiliaze counter and speed    

// check if test = 1

    // get file size of file (do from sub)

// check if test = 1

    // get weak check sum of file (do from sub)

// check if test = 1

    // get weak check sum of array (do from sub) 
    // Note - (I don't use this in the counter but I put this in so I can use it later on if needed.)

// check if test = 1

    // get strong check sum of file (do from sub)

// check if test = 1

    // get strong checksum of array (do from sub)     

// check if test = 1

    // Ask user to move or delete file because it can be over written

// check if test = 1

// ==================================================================================== STARTING FILE CONSTRUCTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    // diff1 = 0

    // diff2 = 0

    // diff3 = 9999999999999999999999999999999999

// check if test = 1

    // Start main loop <<<<<<<<<<<<<<<<<< For file construction

        // Get destination strong check sum of array for first time before counter runs (Do this from sub)

// check if test = 1

         // get diff1 = abs(target strong checksum - destination strong checksum)

// check if test = 1

         // if counterspeedmode = 3 and if diff3 > 1 randomly set speed of speed array (do this from sub)

// check if test = 1

         // if counterspeedmode = 2 and if diff3 > 1 linearly set speed array 

// check if test = 1

    // if diff3 > 1 add speed array to counter array (Do this from sub)

// check if test = 1

    // if tweakspeedmode = 2 and if diff3 < 0 if tweak counter == filesize1 - 1 set tweak counter variable to -1

// check if test = 1

    // if tweakmode = 2 and if diff3 < 0 increase tweak counter variable

// check if test = 1
   
    // if tweak mode = 2 and if diff3 < 0 tweak counter linearly (Do this from sub)

// check if test = 1

    // if tweakmode = 3 and diff3 < 0 tweak counter randomly (do this from sub)

    // get destination strong check sum of counter array for second time after counter runs (Do this from sub)

// check if test = 1

    // get diff2 = abs(target strong checksum - destination strong checksum)

// check if test = 1
    
    // break loop if destination strong sum = target strong check sum

// check if test = 1

    // if abs(diff2 - diff1) < diff3 keep counter

// check if test = 1

    // abs(diff2 - diff1) < diff3 then backup counter (do this from sub)

// check if test = 1

    // if abs(diff2 - diff1) > diff3 restore backup (Do from sub)

// check if test = 1

    // if abs(diff2 - diff1) < diff3 then diff3 = abs(diff1 - diff2) 

// check if test = 1    

    // if (diff3 > 1 display speed)

// check if test = 1

    // if test = 1 then display rolling counter (For testing only )

// check if test = 1

    // if test = 1 then display backup counter (For testing only)

// check if test = 1

    // if test = 1 display diff3, target strong sum, destination strong sum

// check if test = 1

    // repeat main loop for target = destination

// check if test = 1

    // write array to file (FILE RECONSTRUCTED!!!!!!!! YEAH!!!!!!!!!!!!!!!!!!!!! CLAP, CLAP, CLAP LAUGHING AT RAY AND DARBY AND DRINKING MY ADULT BEVERAGE!!!)

// check if test = 1

    // if no command line parameters display FILE CONSTRUCTED

// check if test = 1

    // else exit program

-------------------------------------------------------------------------------
I have the outline up above mostly written and posted at sourceforge.net under time travel project. Its not finished but it is running. In my experiments with throttled binary counters the counter can be added too to bring the destination check sum closer to the target check sum but it also can be subtracted from. So, the outline above has been upgraded. The counters in the outline above have 3 different modes. Random, linear, and none. In none mode it does not run. I will have at least two counters. When the program runs the user can enable or disable each counter and has the choice to run it in linear or random mode. Again, the code is at sourceforge.net

The power of my counters come from two things.
1. Target strong check sum (Where we want to go)
2. Destination strong check sum (Where we are)

I subtract the target from the destination and I get a difference.

Next. I write my program so that as the counter rolls this difference always gets smaller NEVER LARGER.

Now, I can do any damn thing with the binary counter I want . I add large sums of numbers to it. I subtract large sums of number's from it. I can beat it with a virtual baseball bat and not break it. No matter what I do to the counter the difference only gets smaller never larger. So I am good to go. 

My counter ONLY ADVANCES WHEN PROGRESS HAS BEEN MADE. IT NEVER ADVANCES IF PROGRESS HAS BEEN LOST. 

IT CAN RUN FORWARD OR BACKWARDS. NO REAL ALGORITHM NEEDED FOR ADVANCING THE COUNTER FORWARD OR BACKWARDS. 

JUST FILL UP THE SPEED TO BE ADDED TO OR SUBTRACTED FROM THE COUNTER AND ADD IT OR SUBTRACT IT. THAT IS ALL. 

THIS COUNTER ONLY NEEDS THE STRONG CHECK SUM. THE WEAK CHECK SUM IS NOT NEEDED.

THIS IS WHY I CHOOSE THIS COUNTER FOR THE PUBLIC VERSION OF MY COMPUTER TIME TRAVEL CODE.

All the time I test the difference as I run this counter at various speeds. If it is smaller. I keep the counter. If it is larger. I restore the counter to its previous state. The difference when the counter is throttled (speed up) gets smaller very quickly. Even for very large files. The public version of my counter I mainly wrote for Ray Hudson and Darby Phillips and Pamela because they are soooooooo very STUPID!!! 

I needed a binary counter Ray Hudson and Darby Phillips could understand.

For cryptography I have never found a better way to decrypt shit out of space-time itself. My throttled binary counter is the nuclear information bomb. It makes very quick and dirty work of decryption of time travel computer media files. 

This allows me to construct a very large file from its strong check sum on a PC. On a parallel computer this is the shit to have.

This throttled binary counter over the years has allowed me to get some very good high quality time travel computer media files.

I am going to spend most of the night  programming the public version of my time travel code. In the private version of my code there is no document, no video, no computer file in the past, present, future, and alternate time lines that are safe from me. I am running a miniature version of my own CIA and NSA agency that is all mine. I am the director of my own miniature version of those agencies.

As long as I can run my programs and mathematically calculate the check sums of the computer media time travel files I want then I can plug those check sums into my software and reconstruct those files. No matter when or where they exist in space time.

To calculate time travel computer media files strong and weak check sums that is done with the science of statistics. I plot my check sums on x,y charts with regression lines and I use root mean squares and standard deviations. And, that is the plain way I can say that in English.

My calculations for those check sums are a nightmare for the general public to read and understand so I don't even bother to write a whole lot about it in my blog. I think it is suffice to explain it like I did in the paragraph above. Also, nothing I do mathematically to calculate check sums of time time travel computer media is a secret. 

Any Statistician or mathematician can figure it out. Just take known computer media. 

Perform a statistical analysis on it concerning the weak and strong check sums. Then plot and calculate check sums for unknown computer media. Put those check sums in check sum hacking software that will construct the files from the check sums. Then use data mining robots to look through all the hundreds and hundreds and thousands of files produced from this process to find good time travel computer media. Some files may be fully constructed. Others only partially constructed.   

The partially constructed files can be cleaned up by making their strong check sums larger or smaller until the file comes into focus.

And that is how computer time travel is done. With enough analysis it is possible to pick a check sum range out of no where and search it for time travel computer media.

These time travel computer media files can contain information from alien civilizations. It can contain unknown advanced technology. It can contain videos of the Jurassic when the  dinosaurs walked the earth. It can contain news papers from the future. It can contain any type of known or unknown information in the form of text files, videos, audio files, or special files.

Even Hillary Clinton's lost emails even though Hillary deleted them still exist in space time as unreconstructed information. All it takes to reconstruct those emails is to calculate the strong check sum range of her lost emails and put them in my software and my software would reconstruct her emails. I don't have that range and I don't plan to search for that check sum range but that is how Hillary Clinton's erased emails could be constructed.

If anyone reads my very first blog posting I talked about the informational universe. You see, information like matter and energy is never created and it is never destroyed. We live in a continuum. Time never ends and time never begins. Time itself can not be created nor destroyed.

So Hillary Clinton's emails WILL ALWAYS EXIST IN THE INFORMATIONAL UNIVERSE!!!! THAT BITCH CAN'T GET RID OF THEM!!! HAHAHAHAH.....

And because we live in a continuum and because information never can be created nor destroyed all life is basically immortal. All life will live and die over and over again though out eternity as the universe is reborn and dies. That has got to suck for those people that commit suicide. Hahahahhaha............ Time is relative. They will be spit back out to live again and commit suicide again, and again, and again.... Getting back on topic...... So:

With "Time Hacking" ALL INFORMATION IS PUBLIC KNOWLEDGE!!!!! Even Hilary Clinton's emails.


Time Travel Project at http://sourceforge.net will be the depositary for all the software I write for the public on "Time Hacking". I may put my bots there that look at time travel media. I might put a public version of my temporal email program there.

Who knows. It depends on my time and what I got going on in my life and how much longer I live. But, I will write what I can for the public and put it up there. It is my goal to get enough posted there at "Time Travel Project" to allow the public to time hack like I do. Plus, it also makes damn good backup software.

My BNS and my Time Hacking is the way that mankind when he spreads out to outer space to store computer files and to recover computer files that can not be stored.

BNS is at http://sourceforge.net too. But, its only and example program in basic. Later if things go well I will put a full blown public version of my BNS software there.

So, it would be stupid for the government to cover up my stuff. My software is a solution for recovering information lost to time and storing information in space and time. It is not the problem and never was. It could be the way mankind can take his computer files with him to space.

// ------------------------------------------------------------------------------

The CIA through Ray Hudson and Aaron Hiniker has warned me to not post my time travel computer code and threatened me with a deadly accident. FUCK EM!!! Here my current computer code from TIME TRAVEL PROJECT at http://sourceforge.net. I need to finish debugging it. I am posting it so the public can play with "TIME HACKING" and "CHECKSUM HACKING" with my time travel computer code. 

If anyone alters my code just give your counters a counter mode and follow the program parameters and you to can experiment with check sum and time hacking. Here is the code. Again, I have not debugged it. It will run but it may have bugs.

//                     Copyright http://time-travel.institute 
//                     Open source http://sourceforge.net/projects/timetravelproject
//                     This is not finished but it runs.
//                     Thanks, Reactor1967
#include cstdlib
#include iostream
#include stdlib.h
#include fstream
#include sstream
#include string 
#include cmath
#include ctime
#include cstdio
#include iostream
#include /home/reactor1967/mersennetwister.h // This is a dependancy. I MIGHT NOT USE THIS IN THE FINAL PROGRAM. ITS OUTDATED
using namespace std;

// declare subs

    // declare global array counter to max file size
    int counter[100]; // max file size
    
// check if test = 1

    // declare global array speed to max file size
    int speed[100]; // max file size

// check if test = 1

    // declare global array backup to max file size
    int backup[100]; // max file size

// check if test = 1

    // declare global array weights to max file size
    long double weights[100]; // max file size
    
// check if test = 1

    // declare global array random to max file size
    int randomnumgen[100]; // max file size

// check if test = 1;

    // declare global string file1;
    long long globalfilesize = 0;

// check if test = 1;

    // declare global strong check sum;
    long double globalstrongchecksum = 0;

// check if test = 1;

    // declare global weak check sum
    long long globalweakchecksum = 0;

// check if test = 1;

    // declare global file name
    string globalfile = "";

// check if test = 1;  

    // declare global how many weighted sums
    long long globalhowmanyweightedsums = 0;

// check if test = 1;

    // declare global counter speed mode
    long long globalcounterspeedmode;    

// check if test = 1;  
  
    // decleare global tweak counter mode
    long long globaltweakcountermode;

// check if test = 1;  

    // declare global password for weights
    long long globalpassword;

// check if test = 1; 

// ============================================================================================
    // add speed array to counter array
    // check if test = 1
    int addarrays(int test, long long filesize1)
    {

         // declare variables
         long long count1;
         int carry;
         
         // add speed array to counter array
         count1 = -1; 
         carry = 0;
         do
         {
              count1++;
              counter[count1] = counter[count1] + speed[count1] + carry;
              if (counter[count1] > 255)
              {
                   counter[count1] = counter[count1] - 256;
                   carry = 1;
              }
              else
              {
                   carry = 0;
              }
              
         } while(count1 < filesize1 - 1);
         
    }
// ============================================================================================
    // get size of file
// long long filesize
// check if test = 1
long long filesize(int test, string globalfile)
{
// declare variables
    long long begin1;
    long long end1;
    long long filesize1;
    string pause;  
    string file1 = globalfile;

    if (test == 1)
    {
         cout << "Our file. " << file1 << "\n";
         cin >> pause;
    }
  
    // open file1
     fstream myfile1(file1.c_str(), ios::in | ios::binary);
     if (!myfile1)
     {
          myfile1.close();
          cout << "Failed to read file one line 134.\n";
          cin >> pause;
          exit(1);
     }

// get filesize1
     begin1 = myfile1.tellg();
     if (!myfile1)
     {
          myfile1.close();
          cout << "Failed to read file one line 316.\n";
          cin >> pause;
          exit(1);
     }
     myfile1.seekg (0, ios::end);
     end1 = myfile1.tellg();
     filesize1 = (end1-begin1);     

// close file 1
     myfile1.close();
     myfile1.clear();
     myfile1.flush();

// return filesize
     return(filesize1);
// end sub
}

// ============================================================================================
    // get weak sum of file
// check if test = 1
// long long weakchecksum
long long weakchecksumfile(int test, string globalfile) // For some reason will not take buffer size. Debug - FOR NOW MANUALLY ENTER BUFFER SIZE THEN COMPILE.
{
// declare variables
     fstream myfile1;
     int x;
     int buffersize2 = 1;
     long long checksum = 0;
     long long begin1;
     long long count1;
     long long count2;
     unsigned char buffer(buffersize2);
     long long size1;
     long long size2;
     long long filesize;
     string pause;
     int buffersize = 1;
     string file1 = globalfile;

// open file1
     myfile1.open(file1.c_str(), ios:: in | ios:: binary);
     if (!myfile1)
     {
          cout << "122608-12:02 am Unable to open file.\n";
          cin >> pause;
          exit(1); // terminate with error
     }
// get file size
     myfile1.seekg(0, ios::beg);
     size1 = myfile1.tellg();
     myfile1.seekg(0, ios::end);
     size2 = myfile1.tellg();
     filesize = size2 - size1;
// set count1 to 0
     count1 = -1;
// start first loop
     do
     {
          count1++;

// read byte
          begin1 = myfile1.tellg();
          myfile1.seekg(count1);
          if (!myfile1)
          {
               myfile1.close();
               cout << "error in line 51.\n";
               cin >> pause;
               exit(1);
          }
          myfile1.read( reinterpret_cast( &buffer ),buffersize);
          x = (int)buffer;
// calculate weak check sum
          checksum = checksum + x;
// count1 = count1 + buffersize2
// end first loop while (count1 < ((filesize - 1) + buffersize2))
     } while (count1 < filesize - 1);

// close files
     myfile1.close();
     myfile1.clear();
     myfile1.flush();

// return checksum
     return(checksum);
// end sub
}
// ============================================================================================
    // get weak sum of array
// check if test = 1
// long long weakchecksum
long long weakchecksumarray(int test, string globalfile, long long globalfilesize) // For some reason will not take buffer size. Debug - FOR NOW MANUALLY ENTER BUFFER SIZE THEN COMPILE.
{
// declare variables
     int x;
     long long checksum = 0;
     long long count1;
     string pause;

// set count1 to 0
     count1 = -1;
// start first loop
     do
     {
          count1++;

// read byte
          x = counter[count1];
// calculate weak check sum
          checksum = checksum + x;
     } while (count1 < globalfilesize - 1);

// return checksum
     return(checksum);
// end sub
}
// ============================================================================================

    // get strong check sum of file
// check if test = 1
long double getstrongchecksumfile(int test, string globalfile, long long globalpassword , int globalhowmanyweightedsums)
{
// later on if strong check is too small to represent a file then can add by hand in memory array and write that.

//     cout << "Getting weighted check sum\n";
     long double schecksum;
     int byte1 = 0;
     long long count = -1;
     long long count2 = 0;
     long long filesize1 = 0;
     long long begin1 = 0;
     long long end1 = 0;
     long long seednumber = 0;
     int buffersize = 1;
     unsigned char buffer(buffersize);
     long double x1 = 0;
     long long x2 = 0;
     MTRand mtrand1a( 5654940 );
     string pause;
     string file1 = globalfile;
     
     // open file1
     fstream myfile1(file1.c_str(), ios::in | ios::binary);
     if (!myfile1)
     {
          myfile1.close();
          cout << "Failed to read file one.\n";
          cin >> pause;
          exit(1);
     }

// get filesize1
     begin1 = myfile1.tellg();
     if (!myfile1)
     {
          myfile1.close();
          cout << "Failed to read file one.\n";
          cin >> pause;
          exit(1);
     }
     myfile1.seekg (0, ios::end);
     end1 = myfile1.tellg();
     filesize1 = (end1-begin1);

     mtrand1a.seed(5654940);
     count = 0;
     schecksum = 0;
do
     {

          byte1 = 0;
// read file1
          myfile1.seekg(count);
          myfile1.read( reinterpret_cast( &buffer ),buffersize);
          begin1 = myfile1.tellg();
          byte1 = (int)buffer;
          count2 = 0;
     do
          {
               count2++;
      x1 = mtrand1a.randExc(.9999999);
//               weightedsumarray2[count] = weightedsumarray2[count] + (byte1 * x1);
               schecksum = schecksum + (byte1 * x1);
          } while(count2 < globalhowmanyweightedsums);
//           schecksum = schecksum + weightedsumarray2[count];
      count = count + buffersize;
     } while (count < globalfilesize - 1);

     myfile1.close();
     myfile1.clear();

     return(schecksum);

}

// ============================================================================================

    // get strong check sum of array
// check if test = 1
long double getstrongchecksumarray(int test, long long globalpassword, int globalhowmanyweightedsums, long long globalfilesize)
{
     long double schecksum;
     int byte1 = 0;
     long long count = -1;
     long long count2 = 0;
     long double x1 = 0;
     long long x2 = 0;
     MTRand mtrand1a( globalpassword );
     string pause;

     mtrand1a.seed(globalpassword);
     count = 0;
     schecksum = 0;
do
     {

          byte1 = 0;
// read array
          byte1 = counter[count];
          count2 = 0;
     do
          {
               count2++;
      x1 = mtrand1a.randExc(.9999999);
               schecksum = schecksum + (byte1 * x1);
          } while(count2 < globalhowmanyweightedsums);
          count = count + 1;
     } while (count < globalfilesize - 1);
     return(schecksum);

}
// ============================================================================================
    // randomly set speed of speed array
// check if test = 1
int setspeedrandom(int test, long long globalpassword, long long globalfilesize)
{

// declear variables
                  long long count1;
                  int byte1;
                  long long filesize2;
                  MTRand mtrand1a(globalpassword);
                  mtrand1a.seed(globalpassword); 
                  long long seed;
                  string pause;

// Erase counter speed
                   count1 = -1;
                   do
                   {
                        byte1 = 0;
                        count1++;
                        speed[count1] = byte1;
                   } while(count1 < globalfilesize);
         
// Randomly set counter speed
                   seed = mtrand1a.randInt(globalpassword);
                   mtrand1a.seed(seed);
                   filesize2 = mtrand1a.randInt(globalfilesize);
                   count1 = -1;
                   do
                   {
                        byte1 = mtrand1a.randInt(255);
                        count1++;
                        speed[count1] = byte1;              
                   } while(count1 < filesize2);
                   return(0);
}

// ============================================================================================

    // linearly set speed of array
// check if test = 1
int setspeedlinear(int test, long long globalfilesize, long long counterspeed)
{
         // declare variables
         int carry;
         long long count1;
         string pause;
  
        // add speed array to speed array (Put do loop around this to magnify it if needed)
         counterspeed++;
         carry = 0;
         count1 = -1;                       
         do
         {
              count1++;
              if (count1 == 0)
              {
                   speed[count1] = speed[count1] + 1 + carry;
              }

              if (count1 > 0)
              {
                   speed[count1] = speed[count1] + carry;
              }

              // speed[count1] = speed[count1] + speed[count1] + carry;              
              if (speed[count1] > 255)
              {
                   speed[count1] = speed[count1] - 256;
                   carry = 1;
              }
              else
              {
                   carry = 0;
              }
         } while(count1 < globalfilesize - 1);
         return(counterspeed);
}
// ============================================================================================

    // tweak counter in linear mode
// check if test = 1
int tweakcounterlinear(int test, int globaltweakcountermode, long long globalfilesize, long long tweakcount, string updown)
{

    
    // declare variables
    string pause;

// get out if tweakmode not = two
    if (globaltweakcountermode != 1)
    {
         cout << "Warning wrong tweak mode." << "\n";
         cin >> pause;
         exit(1);
    }

    // check if tweak count is valid
    if (tweakcount > globalfilesize - 1)
    {
         cout << "Tweak count too large." << "\n";
         cin >> pause;
         exit(1);
    }
    // if updown up go up
    if (updown == "+")
    {
         counter[tweakcount]++;
    }

    // if updown down go down
    if (updown == "-")
    {  
         counter[tweakcount]--;
    }
    return(0);
}
// ============================================================================================

    // tweak counter in random mode
// check if test = 1

int tweakcounterrandom(int test, int globaltweakcountermode, long long globalfilesize, long long globalpassword)
{

    
    // declare variables
    string pause;
    MTRand mtrand1a(globalpassword); // WARNING - WE WANT PASSWORD TO BE DIFFERENT EVERY TIME THIS IS CALLED!!!!!
    mtrand1a.seed(globalpassword);
    long long tweakcount;
    string updown; 
    int tweak;
    long long seed;
    
    seed = mtrand1a.randInt(globalpassword);
    mtrand1a.seed(globalpassword);
    tweakcount = mtrand1a.randInt(globalfilesize - 1);
    tweak= mtrand1a.randInt(1);
    if (tweak == 0)
    {
         updown = "-";
    }
    if (tweak == 1)
    {
         updown = "+";
    }   

// get out if tweakmode not = two
    if (globaltweakcountermode != 2)
    {
         cout << "Warning wrong tweak mode." << "\n";
         cin >> pause;
         exit(1);
    }

    // check if tweak count is valid
    if (tweakcount > globalfilesize - 1)
    {
         cout << "Tweak count too large." << "\n";
         cin >> pause;
         exit(1);
    }
    // if updown up go up
    if (updown == "+")
    {
         counter[tweakcount]++;
    }

    // if updown down go down
    if (updown == "-")
    {  
         counter[tweakcount]--;
    }
    return(0);
}

// ============================================================================================
    
    // restore counter array
// check if test = 1
int restorecounter(int test, long long globalfilesize)
{
     
     // declare variables
     long long count1;

     // declare variables
     count1 = -1;
     do
     {
          count1++;
          counter[count1] = backup[count1];
     } while(count1 < globalfilesize - 1); 
     return(0);
}
// ============================================================================================

    // backup counter array
// check if test = 1
int backupcounter(int test, long long globalfilesize)
{
     // declare variables
     long long count1 = -1;
     do
     {
          count1++;
          backup[count1] = counter[count1];
     } while(count1 < globalfilesize - 1);
     return(0);     
}
// ============================================================================================
int randomnumbers(int test, long long filesize1, long long password)
{
// check if test = 1
    // Create random number file using the Burris Algorithm
         // get a random weak sum for a specific file size using pseudo random number generator
         // randomly create file that specific size
         // randomly bring file to weak sum
         // implement RAY HUDSONS TOSS SALAD ALGORITM.
    // declare variables


    // create random file routine
    MTRand mtrand1a( password );
    mtrand1a.seed(password);
    long long maxsum1 = (filesize1 -1) * 255;
    long long weakchecksum2 = mtrand1a.randInt(maxsum1);
    long long weakchecksum1 = 0;
    long long count1 = -1;    
    long long count2 = -1;
    do
    {
         count1++;
         randomnumgen[count1] = mtrand1a.randInt(255);
         weakchecksum1 = weakchecksum1 + randomnumgen[count1];
    } while(count1 < filesize1 - 1);

    // bring checksum up routine <<<<<<<<<<<<<<<<<<< debug this
    if (weakchecksum1 < weakchecksum2)
    {
         do
         {
              count1 = mtrand1a.randInt(filesize1 - 1);
              randomnumgen[count1] = randomnumgen[count1] + 1;
              weakchecksum1++;
         } while(weakchecksum1 != weakchecksum2);

    }

    // bring checksum down routine
    if (weakchecksum1 > weakchecksum2)
    {
         do
         {
              count1 = mtrand1a.randInt(filesize1 - 1);
              randomnumgen[count1] = randomnumgen[count1] - 1;
              weakchecksum1--;
         } while(weakchecksum1 != weakchecksum2);

    }

    // Ray's toss salad routine <<<<<<<<<<<<<<<<< Debug this
    count1 = -1;
    count2 = -1;
    long long count3 = -1;
    int byte1 = 0;
    int byte2 = 0;
    do
    {
         count1 = mtrand1a.randInt(filesize1 - 1);
         count2 = mtrand1a.randInt(filesize1 - 1);
         if (count1 != count2)
         {
              count3++;
              byte1 = randomnumgen[count1];
              byte2 = randomnumgen[count2];
              randomnumgen[count1] = byte2;
              randomnumgen[count2] = byte1;
         }  
     } while(count3 < (filesize1 * 2));   

     return(0);
}
// ============================================================================================

    // Load project from config file
// check if test = 1
int loadconfig(int test)
{
//    long long globalfilesize = 0;

//    long double globalstrongchecksum = 0;

//    long long globalweakchecksum = 0;

//    string globalfile = "";
    // declare variables
    string dummy;
    string pause;


// Load configure file
          fstream c1myfile("filechecksumconfig.txt", ios::in);
          // read name of file
          c1myfile >>  dummy >> dummy >> dummy >> globalfile;
          // read weak check sum
          c1myfile >>  dummy >> dummy >> globalweakchecksum;
          // read strong check sum 
          c1myfile >>  dummy >> dummy >> globalstrongchecksum;
          // read file size
          c1myfile >>  dummy >> dummy >> dummy >> globalfilesize;
          // read how many weights
          c1myfile >>  dummy >> dummy >> dummy>> dummy >> dummy >> globalhowmanyweightedsums;
          // read mode for counter speed for linear or random or none
          c1myfile >>  dummy >> dummy >> dummy>> dummy >> globalcounterspeedmode;
          // read mode for tweak counter for linear or random or none
          c1myfile >>  dummy >> dummy >> dummy>> dummy >> globaltweakcountermode;
          // read password for weights
          c1myfile >> dummy >> dummy >> dummy >> globalpassword;

         // close configure file
          c1myfile.close();
          c1myfile.clear();
          c1myfile.flush();

         // Print configure file to confirm loaded correctly
          cout << "File name > " << globalfile << "\n";
          cout.precision(36);
          cout << "Weak check-sum > " << globalweakchecksum << "\n";
          cout.precision(36);
          cout << "Strong check-sum > " << globalstrongchecksum << "\n";
          cout.precision(36);
          cout << "File size > " << globalfilesize << "\n";
          cout.precision(36);
          cout << "How many weighted check-sums > " << globalhowmanyweightedsums << "\n";
          cout << "Global counter mode > " << globalcounterspeedmode << "\n";    
          cout << "Global tweak counter mode > " << globaltweakcountermode << "\n";
          cout << "Global password for weights > " << globalpassword << "\n";
          cout << "\n"; 
          cout << "Is the configuration file loaded properly?" << "\n";
          cin >> pause;
          return(0);
//        
}
// ============================================================================================
int generateweights(int test, long long password)
{

// declare variables
    MTRand mtrand1a(password);
    mtrand1a.seed(password);
    long long count2;
    long double x1;
    long double x2;
    
// Generate weights
    count2 = -1;
    do
    {
         count2++;
         x1 = mtrand1a.randExc(.9999999);
         weights[count2] = x1;
    } while (count2 < (globalhowmanyweightedsums * globalfilesize));
    
    // do bubble sort of weights
    do
    {
         count2 = -1;
         test = 0;
         do
         { 
              count2++;
              if (weights[count2] > weights[count2 + 1])
              {
                   x1 = weights[count2];
                   x2 = weights[count2 + 1];
                   test = 1;
                   weights[count2] = x2;
                   weights[count2 + 1] = x1;
              }
         } while(count2 < (globalhowmanyweightedsums * globalfilesize));         
    } while(test > 0);
    return(0);
}
// ============================================================================================
int initilizearrays(int test, long long maxarraysize)
{
    // declare variables
    long long count1 = -1; 
    do
    {
         count1++;
         counter[count1] = 0; // max file size
         speed[count1] = 0; // max file size
         backup[count1] = 0; // max file size
         weights[count1] = 0; // max file size
         randomnumgen[count1] = 0; // max file size
    } while(count1 < maxarraysize);
    return(0);   

}

// ============================================================================================
// Display speed
// check if test = 1
int displayspeed(int test, long long globalfilesize)
{
     // declare variables
     long long count1 = -1;
     do
     {
          count1++;
          cout << speed[count1];
     } while(count1 < globalfilesize - 1);
     cout << "\n";
     cout << " " << "\n";
     return(0);     
}
// ============================================================================================
// Display counter
// check if test = 1
int displaycounter(int test, long long globalfilesize)
{
     // declare variables
     long long count1 = -1;
     do
     {
          count1++;
          cout << counter[count1];
     } while(count1 < globalfilesize - 1);
     cout << "\n";
     cout << " " << "\n";
     return(0);     
}
// ============================================================================================
// Display backup counter
// check if test = 1
int displaybackupcounter(int test, long long globalfilesize)
{
     // declare variables
     long long count1 = -1;
     do
     {
          count1++;
          cout << backup[count1];
     } while(count1 < globalfilesize - 1);
     cout << "\n";
     cout << " " << "\n";
     return(0);     
}
// ============================================================================================
// Write counter to file.
int writecountertofile(int test, long long globalfilesize, string globalfile)
{
     long long count1 = -1;
     string file1 = globalfile;
     unsigned char buffer;
     int buffersize = 1;
     long long begin1;
     char pause;
     int byte1;

    // open counter file
     fstream myfile1(file1.c_str(), ios:: out | ios:: binary);
     if (!myfile1)
     {
          cout << "Error in line 841.\n";
          cin >> pause;
          myfile1.close();
          myfile1.clear();
          myfile1.flush();
          exit(1); // terminate with error
     }
     
     do
     {

         count1++;
         byte1 = counter[count1];
         buffer = (unsigned char)byte1;
         myfile1.seekp(count1);
         myfile1.write( reinterpret_cast( &buffer ),buffersize);
         begin1 = myfile1.tellp();

     } while(count1 < globalfilesize - 1);
     return(0);         


}


// ============================================================================================

// Start main   
int main (int argc, char *argv[])


    // Declare variabes - CHECK OUT ALL VARAIBLES TO MAKE SURE THEY ARE BEING USED. IF NOT DELETE THEM.
    long long count1 = 0;
    string pause;
    char choice;
    string choice2;
    stringstream ss;
    long long test = 0;
    long long config;
    long long password; // check this out. I might not be using this variable
    int dummyfile;
    long long maxarraysize;
    long long weakchecksumfile1; // check this out
    long long weakchecksumarray1; // checkk this out
    long double strongchecksumfile1; // check this out
    long double strongchecksumarray1; // check this out
    long double diff1 = 0;
    long double diff2 = 0;
    long double diff3 = 99999999999999;
    long double targetstrongsum; // check if using this?
    long double destinationstrongsum;
    long double backdestinationstrongsum;
    long long counterspeed; // check if using this?
    long long counterspeed2; // check if using this?
    long long tweakcount; // file position for tweaking counter.
    string updown; // decides if a byte gets increased or decreased.
    
// set count for counter to -1
// set count for speed to -1
// set count for tweak to -1
    
// check if test = 1     

    // if testing program for debugging set test to 1 to display checks else set test to 0
    if (argc == 1) 
    {
         if (test == 1)
         {
              cout << "No arguments " << argc << "\n";
              cin >> pause;
         }    
         goto jump1;
    } 

// passing command line arguments to program
    test = strtoull(argv[11],NULL,10);

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Test argument 11 " << test << "\n";
         cin >> pause;
    }    


     // WE GET SEGMENTATION FAULT WHEN NO VALUES PASSED
    // passing command line arguments to program
    globalfile = argv[1];

// check if test = 1
    if (test == 1)
    {
         cout << "Globalfile argument 1 " << globalfile << "\n";
         cin >> pause;
    }

    if (globalfile == "help")
    {
         cout << "Order of command line arguments." << "\n";
         cout << "1 file" << "\n";
         cout << "2 weak check sum" << "\n";
         cout << "3 strong check sum" << "\n";
         cout << "4 file size" << "\n";
         cout << "5 How many weighted sums" << "\n";
         cout << "6 speed mode - 2=Random 1=linear 0=none" << "\n";
         cout << "7 tweak mode - 2=Random 1=linear 0=none" << "\n";
         cout << "8 menu choice 1 only right now. So use 1" << "\n";
         cout << "9 config file - 1 = yes 0 = no" << "\n";
         cout << "10 password" << "\n";
         cout << "11 test 1 = yes 0 = no" << "\n";
         cin >> pause;
         exit(0);
    }    

    // passing command line arguments to program
    globalweakchecksum = strtoull(argv[2],NULL,10);

// check if test = 1
    if (test == 1)
    {
         cout.precision(36);
         cout << "Globalweakchecksum argument 2 " << globalweakchecksum << "\n";
         cin >> pause;
    }    

    // passing command line arguments to program
    ss << argv[3];
    ss >> globalstrongchecksum;

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Globalstrongchecksum argument 3 " << globalstrongchecksum << "\n";
         cin >> pause;
    }    

    // passing command line arguments to program 
    globalfilesize = strtoull(argv[4],NULL,10); // NEVER MORE THAN 4 BYTES. I USE THIS FOR COUNTERS LESS THAN 2 BYTES

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Globalfilesize argument 4 " << globalfilesize << "\n";
         cin >> pause;
    }    

   // passing command line arguments to program
   globalhowmanyweightedsums = strtoull(argv[5],NULL,10);

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Globalhowmanyweightedsums argument 5 " << globalhowmanyweightedsums << "\n";
         cin >> pause;
    }    

    // passing command line arguments to program
    globalcounterspeedmode = strtoull(argv[6],NULL,10);

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Globalcounterspeedmode argument 6 " << globalcounterspeedmode << "\n";
         cin >> pause;
    }    

// passing command line arguments to program
    globaltweakcountermode = strtoull(argv[7],NULL,10);

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Globaltweakcountermode argument 7 " << globaltweakcountermode << "\n";
         cin >> pause;
    } 


// passing command line arguments to program
    config = strtoull(argv[9],NULL,10);

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "config argument 9 " << config << "\n";
         cin >> pause;
    }

// passing command line arguments to program
    globalpassword = strtoull(argv[10],NULL,10);

// check if test = 1
    if (test == 1)
    {    cout.precision(36);
         cout << "Password argument 10 " << globalpassword << "\n";
         cin >> pause;
    }    

   // passing command line arguments to program 
   choice2 = argv[8];

// check if test = 1
    if (test == 1)
    {
         cout << "choice argument 8 " << choice2 << "\n";
         cin >> pause;
    }
    
    if (choice2 == "1")
    {
         choice = '1';
         goto jump2;
    }    

//         <<<<<<<<<<<<<<<<<<< PUT REST OF MENU ARGUMENTS HERE!!!!!!   

    // If arguments skip to jump (THIS IS FOR RUNNING IN PARALLEL AND COMMAND LINE ONLY!!!!!!!!!!!!!!!!!) WHEN PROGRAM IS FINISHED.

    // make menu here
jump1:
    cout << "(1) Construct a file from a check sum." << "\n";
    cin >> choice;

jump2:  

    if (choice == '1') // construct file
    {

// check if test = 1
         if (test == 1)
         {
              cout << "We made it to choice 1 " << "\n";
              cin >> pause;
         }

         if (argc > 1) 
         {
              if (test == 1)
              {
                   cout << "we have arguments " << argc << "\n";
                   cin >> pause;
              }    
              goto jump3;
         }

    // ask user if this is a config file yes or no
    cout << "If you have a config file type 1 and enter. Else type 0 and enter." << "\n";
    cin >> config;

// check if test = 1
         if (test == 1)
         {
              cout << "Config " << config << "\n";
              cin >> pause;
         }

// if config file goto jump
         if (config == 1)
         {
              goto jump3;
         }

    // ask user file name
         cout << "Please enter the name of your target file." << "\n";
         cin >> globalfile;

// check if test = 1
         if (test == 1)
         {
              cout << "Globalfile " << globalfile << "\n";
              cin >> pause;
         }

         cout << "What is your max array size?" << "\n";
         cin >> maxarraysize;

         if (test == 1)
         {
              cout << "Max Array size. " << maxarraysize << "\n";
         }  

    // ask user to set mode for counter speed for linear or random or none
         cout << "Please enter the mode for the counter speed" << "\n";
         cout << " 0 = none (dont run), 1 = Linear mode, 2 = Random mode." << "\n";
         cin >> globalcounterspeedmode;

// check if test = 1
         if (test == 1)
         {
              cout << "Globalcounterspeedmode " << globalcounterspeedmode << "\n";
              cin >> pause;
         }

    // ask user to set mode for tweak counter for linear or random or none
         cout << "Please enter the mode for the tweak counter" << "\n";
         cout << " 0 = none (dont run), 1 = Linear mode, 2 = Random mode." << "\n";
         cin >> globaltweakcountermode;

// check if test = 1
         if (test == 1)
         {
              cout << "Globaltweakcountermode " << globaltweakcountermode << "\n";
              cin >> pause;
         }    

    // ask how many weights to use for strong check sum
         cout << "How many weighted sums are we using?" << "\n";
         cin >> globalhowmanyweightedsums;

// check if test = 1
         if (test == 1)
         {
              cout << "Globalhowmanyweightedsums " << globalhowmanyweightedsums << "\n";
              cin >> pause;
         }

    // ask seed number for random number generator
         cout << "What is the seed number for your weights?" << "\n";
         cin >> globalpassword;

// check if test = 1
         if (test == 1)
         {
              cout << "Globalpassword " << globalpassword << "\n";
              cin >> pause;
         }

    // jump point here if ran from command line
jump3:

// if this is a config file load config file
        if (config == 1)
        {
             dummyfile = loadconfig(test);
        }

// check if test = 1
        if (test == 1)
        {
             if (config == 1)
             {
                  cout << "Configure file loaded." << "\n";
                  cin >> pause;
             }
        }

    // Generate weights in array // Bubble sort weights
        dummyfile = generateweights(test, password);

// check if test = 1
        if (test == 1)
        {
             cout << "Weights generated and bubble sorted." << "\n";
             cin >> pause;
        }    

    // initiliaze all arrays   
       dummyfile = initilizearrays(test, maxarraysize); 

// check if test = 1
       if (test == 1)
       {
            cout << "All arrays initilized" << "\n";
            cin >> pause;
       }    

    // get file size of file (do from sub)
    globalfilesize =  filesize(test, globalfile); 
    
// check if test = 1
    if (test == 1)
    {
         cout << "Got size of file > " << globalfile << " " << globalfilesize << "\n";
         cin >> pause;
    }

    // get weak check sum of file (do from sub)
    weakchecksumfile1 = weakchecksumfile(test, globalfile);

// check if test = 1
    if (test == 1)
    {
         cout << "Got weak check sum of file > " << globalfile << " " << weakchecksumfile1 << "\n";
         cin >> pause;
    }

    // get weak check sum of array (do from sub) 
    // Note - (I don't use this in the counter but I put this in so I can use it later on if needed.)
    weakchecksumarray1 = weakchecksumarray(test, globalfile, globalfilesize);

// check if test = 1
    if (test == 1)
    {
         cout << "Got weak check sum of array > " << globalfile << " " << weakchecksumarray1 << "\n";
         cin >> pause;
    }

    // get strong check sum of file (do from sub)
    strongchecksumfile1 = getstrongchecksumfile(test, globalfile, globalpassword , globalhowmanyweightedsums);

// check if test = 1
    if (test == 1)
    {
         cout << "Got strong check sum of file > " << globalfile << " " << strongchecksumfile1 << "\n";
         cin >> pause;
    }


    // get strong checksum of array (do from sub)
    strongchecksumarray1 = getstrongchecksumarray(test, globalpassword, globalhowmanyweightedsums, globalfilesize);

// check if test = 1
    if (test == 1)
    {
         cout << "Got strong check sum of array > " << globalfile << " " << strongchecksumarray1 << "\n";
         cin >> pause;
    }

    // set globalstrongchecksum
    if (strongchecksumarray1 == 0)
    {
         if (strongchecksumfile1 > 0)
         {
              globalstrongchecksum = strongchecksumfile1;
         }
    }
  
// check if test = 1
    if (test == 1)
    {
         if (strongchecksumarray1 == 0)
         {
              if (strongchecksumfile1 > 0)
              {
                   cout << "Took strong check sum from file. " << globalstrongchecksum << "\n";
              }
         }
    } 

    if (strongchecksumarray1 > 0)
    {
         if (strongchecksumfile1 == 0)
         {
              globalstrongchecksum = strongchecksumarray1;
         }
    }
  
// check if test = 1
    if (test == 1)
    {
         if (strongchecksumarray1 > 0)
         {
              if (strongchecksumfile1 == 0)
              {
                   cout << "Took strong check sum from array " << globalstrongchecksum << "\n";
              }
         }
    }      

     // if config = no Ask user to move or delete file because it can be over written
    if (config == 0)
    {
         cout << "Please move or delete your file. It may get over written." << "\n";
         cin >> pause;
    }
     
// check if test = 1
    if (test == 1)
    {
         cout << "Just ask user to move or delete file" << "\n";
         cin >> pause;
    }

// ==================================================================================== STARTING FILE CONSTRUCTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    // diff1 = 0
    diff1 = 0;

    // diff2 = 0
    diff2 = 0;

    // diff3 = 9999999999999999999999999999999999
    diff3 = 99999999999999;

// check if test = 1
    if (test == 1)
    {
         cout.precision(36);
         cout << "Diff1, Diff2, Diff3 > " << diff1 << " " << diff2 << " " << diff3 << " " << "\n";
         cin >> pause;
    }

    // Start main loop <<<<<<<<<<<<<<<<<< For file construction
    do
    { // Starting main loop for file consntruction <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

        // Get destination strong check sum of array for first time before counter runs (Do this from sub)
    destinationstrongsum = getstrongchecksumarray(test, globalpassword, globalhowmanyweightedsums, globalfilesize);
    
 // check if test = 1
    if (test == 1)
    {
         cout << "Got strong check sum of array > " << globalfile << " " << destinationstrongsum << "\n";
         cin >> pause;
    }

    // Store destination check sum so we can test if our counter is rolling.
    backdestinationstrongsum = destinationstrongsum;
    if (test == 1)
    {
         cout << "Backup destination strong check sum. " << backdestinationstrongsum << "\n";
    }
    
    // get diff1 = abs(target strong checksum - destination strong checksum)
    diff1 = abs(globalstrongchecksum - destinationstrongsum);

// check if test = 1
    if (test == 1)
    {
         cout << "First time you run this diff1 will be the strong check sum for the file. " << "\n";
         cout << "Got diff1 for first time before counter runs > " << diff1 << " strong check sum " << globalstrongchecksum << " " << destinationstrongsum << "\n";
         cin >> pause;
    }

    // if counterspeedmode = 2 and if diff3 > 1 randomly set speed of speed array (do this from sub)
    if (globalcounterspeedmode == 2)
    {
         if (diff3 > 1)
         {
              dummyfile = setspeedrandom(test, globalpassword, globalfilesize);
         } 

    }

// check if test = 1
    if (test == 1)
    {
         cout << "if globalcounterspeedmode = 2 randomly set speed of speed array" << globalcounterspeedmode << "\n";
         cin >> pause;
    }


    // if counterspeedmode = 1 and if diff3 > 1 linearly set speed array 
    if (globalcounterspeedmode == 1)
    {
         if (diff3 > 1)
         {
              counterspeed2 = setspeedlinear(test, globalfilesize, counterspeed);

         } 

    }

// check if test = 1
    if (test == 1)
    {
         cout << "if globalcounterspeedmode = 1 linearly set speed of speed array" << globalcounterspeedmode << "\n";
         cin >> pause;
    }

    // if diff3 > 1 add speed array to counter array (Do this from sub)
    if (diff3 > 1)
    {
         dummyfile = addarrays(test, globalfilesize);
    }

// check if test = 1
    if (test == 1)
    {
         cout << "The counter has been rolled!!!" << "\n";
         cin >> pause;
    }

   // if tweakspeedmode = 1 and if diff3 < 1 if tweak counter == filesize1 - 1 set tweak counter variable to -1
   if (globaltweakcountermode == 1)
   {
        if (diff3 < 1)
        {
            if (speed[globalfilesize-1] == 255)
            {
                 // Set counter variable to -1 for running in linear mode. Come back to this <<<<<<<<<<<<<<<<<<<<<< COME BACK TO THIS!!!!!!!!!!!!!!!!!!
                 tweakcount = -1;
            }   
        } 
   }

// check if test = 1
   if (test == 1)
   {
        if (globaltweakcountermode == 1)
        {
             if (diff3 < 1)
             {
                  if (speed[globalfilesize-1] == 255)
                  {
                // Was the counter variable to -1? for running in linear mode. Come back to this <<<<<<<<<<<<<<<<<<<<<< COME BACK TO THIS!!!!!!!!!!!!!!!!!!
                       cout << "Tweakcount " << tweakcount << "\n";
                  }  
             } 
        }
   }

   // if tweakmode = 1 and if diff3 < 1 increase tweak counter variable
   if (globaltweakcountermode == 1)
   {
        if (diff3 < 1)
        {
        // Increase counter variable <<<<<<<<<<<<<<<<<<<<<< COME BACK TO THIS!!!!!!!!!!!!!!!!!! 
             tweakcount++;     
        }
   }

// check if test = 1
   if (test == 1)
   {
        if (globaltweakcountermode == 1)
        {
             if (diff3 < 1)
             {
                  // WAS COUNTER VARIABLE INCREASED? <<<<< Come back to this.
                  cout << "Tweakcount " << tweakcount << "\n";       
             } 
        }
   }
   
    // if tweak mode = 1 and if diff3 < 1 tweak counter linearly (Do this from sub)
   if (globaltweakcountermode == 1)
   {
        if (diff3 < 1)
        {
             dummyfile = tweakcounterlinear(test, globaltweakcountermode, globalfilesize, tweakcount, updown);
        }

   }

// check if test = 1
   if (test == 1)
   {
        if (globaltweakcountermode == 1)
        {
             cout << "Tweak counter has been run linearly." << "\n";
        }
   }

    // if tweakmode = 2 and diff3 < 1 tweak counter randomly (do this from sub)
   if (globaltweakcountermode == 2)
   {
        if (diff3 < 1)
        {
             dummyfile = tweakcounterrandom(test, globaltweakcountermode, globalfilesize, globalpassword); 
        }
   }

// check if test = 1
   if (test == 1)
   {
        if (globaltweakcountermode == 2)
        {
             cout << "Tweak counter has been run randomly." << "\n";
        }
   }

    // get destination strong check sum of counter array for second time after counter runs (Do this from sub)
   destinationstrongsum = getstrongchecksumarray(test, globalpassword, globalhowmanyweightedsums, globalfilesize);

// check if test = 1
   if (test == 1)
   {
        cout << "Destination strong sum taken for second time. " << destinationstrongsum << "\n";
   }

//   cout << backdestinationstrongsum << " " << destinationstrongsum << "\n";
//   cin >> pause;

   // test to see if counter has rolled.
   if (backdestinationstrongsum == destinationstrongsum)
   {
        cout << "Dude or Dudeat your counter IS NOT ROLLING!!! This needs fixed" << "\n";
        cin >> pause;
        exit(0);
   }

    // get diff2 = abs(target strong checksum - destination strong checksum)
    diff2 = abs(globalstrongchecksum - destinationstrongsum);

// check if test = 1
   if (test == 1)
   {
        cout << "diff2 > " << diff2 << "\n";
   }
    
   if (test == 1)
   {

        if (globalstrongchecksum == destinationstrongsum)
        {
             cout << "We are fixing to use the break instead of the loop to exit program." << "\n";
             cin >> pause;
        }
   }

    // break loop if destination strong sum = target strong check sum
   if (globalstrongchecksum == destinationstrongsum)
   {
        break;
    }

// check if test = 1
    if (test == 1)
    {
         if (globalstrongchecksum == destinationstrongsum)
         {
              cout << "FILE RECONSTRUCTED BUT PROGRAM DID NOT EXIT!!!!" << "\n";
         }
    }

    // if abs(diff2 - diff1) < diff3 keep counter
    if (abs(diff2 - diff1) < diff3)
    {
         // We are keeping this counter
    }

// check if test = 1
    if (test == 1)
    {
         if (abs(diff2 - diff1) < diff3)
         {
              // We are keeping this counter
              cout << "We are keeping the counter " << abs(diff2 - diff1) << " " << diff3 << "\n";
         }
    }


    // abs(diff2 - diff1) < diff3 then backup counter (do this from sub)
    if (abs(diff2 - diff1) < diff3)
    {
         // We are backing up the counter.
//         dummyfile = backupcounter(test, globalfilesize);
    }

// check if test = 1
    if (test == 1)
    {
         if (abs(diff2 - diff1) < diff3)
         {
              // We are keeping this counter
              cout << "We are backuped the counter " << abs(diff2 - diff1) << " " << diff3 << "\n";
         }
    }


    // if abs(diff2 - diff1) > diff3 restore backup (Do from sub)
    if (abs(diff2 - diff1) > diff3)
    {
//         dummyfile = restorecounter(test, globalfilesize);
    }


// check if test = 1
    if (test == 1)
    {
         cout << "Counter restored. " << abs(diff2 - diff1) << " " << diff3 << "\n";
    }

    // if abs(diff2 - diff1) < diff3 then diff3 = abs(diff1 - diff2) 

    if (abs(diff2 - diff1) < diff3)
    {
         diff3 = abs(diff2 - diff1);
    }

// check if test = 1
    if (test == 1)
    {
         if (abs(diff2 - diff1) < diff3)
         {
              cout << "New diff3. " << abs(diff2 - diff1) << " " << diff3 << "\n";
         }
    }    

// Displayed speed. For testing only
    if (test == 1)
    {
         if (diff3 > 1)
         {
              dummyfile = displayspeed(test, globalfilesize);
         }
    }

    // if test = 1 then display rolling counter (For testing only )
    if (test == 1)
    {
         if (diff3 > 1)
         {
              dummyfile = displaycounter(test, globalfilesize);
         }
    }

    // if test = 1 then display backup counter (For testing only)
   if (test == 1)
    {
         dummyfile = displaybackupcounter(test, globalfilesize);
    }

    // if test = 1 display diff3, target strong sum, destination strong sum
    if (test == 1)
    {
         cout.precision(36);
         cout << diff3 << " " << globalstrongchecksum << " " << destinationstrongsum << "\n";
    }

    cout.precision(36);
    cout << diff3 << " " << destinationstrongsum << "\n"; // for testing. Comment this out later.

    // repeat main loop for target = destination
    } while(globalstrongchecksum != destinationstrongsum); // END MAIN LOOP FOR FILE RECONSTRUCTION<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

// check if test = 1
    if (test == 1)
    {
         cout << "We have exited from reconstruction loop." << "\n";
    } 

    // write array to file (FILE RECONSTRUCTED!!!!!!!! YEAH!!!!!!!!!!!!!!!!!!!!! CLAP, CLAP, CLAP LAUGHING AT RAY AND DARBY AND DRINKING MY ADULT BEVERAGE!!!)

    dummyfile = writecountertofile(test, globalfilesize, globalfile);

// check if test = 1
    if (test == 1)
    {
         cout << "I wrote counter to file. Check your files." << "\n";
    }

    // if no command line parameters display FILE CONSTRUCTED
    if (argc == 1) 
    {
              cout << "FILE RECONSTRUCTED!!!" << "\n";
              cin >> pause;
    } 


// check if test = 1
    if (test == 1)
    {
              cout << "No arguments and I printed file reconstructed argc = " << argc << "\n";
              cin >> pause;
    }    


    // exit program
    exit(0);

    } // END IF CHOICE == 1

}
-------------------------------------------------------------------------------------------------------------

Well I have been debugging the code above. It will compile but it will not run properly. When I get it debugged I will have to re-post it. I love that test mode I wrote in. It has made debugging this beast a dream.