Tuesday, 17 October 2017

DiceLockSecurity Knowledge

DicelockSecurity (version 9.X)

Windows - Source Code

DiceLock 9.0.0.1
DiceChecker 6.0.0.1
HashDigester 6.0.0.1
DiceLockTime 4.0.0.1
Previous Versions
arrow DiceLock 9.0.0.1 arrow randomTestSuite.cpp
randomTestSuite.cpp (Random number test suite C++ source code file) Print E-mail
Get C++ DiceLock cipher architecture source code packages of DiceLock for Microsoft Visual Studio 2013 and DiceLock-x for Linux with Test Driver Programs and Response Test Vector files to verify that both them work as expected.
DiceLock for Windows and Linux
DiceLock Security governing software licenses are Free/Libre Source Code License and Educational and Research License
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
 
//
// Creator:    http://www.dicelocksecurity.com
// Version:    vers.9.0.0.1
//
// Copyright (C) 2008-2013 DiceLock Security, LLC. All rights reserved.
//
//                               DISCLAIMER
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// 
// DICELOCK IS A REGISTERED TRADEMARK OR TRADEMARK OF THE OWNERS.
// 
// DICELOCK IS PROTECTED BY US PATENT 7508945 AND EUROPEAN PATENT 1182777 WHERE APPLICABLE.
//
// LICENSE INFORMATION CAN BE OBTAINED AT CORPORATE WEB SITE
//
 
#include <stdlib.h>
#include "randomTestSuite.h"
 
 
namespace DiceLockSecurity {
  
  namespace RandomTest {
 
    // Points the first random test in the suite
    const RandomTests RandomTestSuite::firstTest = Frequency;
 
    // Constructor, default, initializes suite and instantiates MathematicalFunctions  
    RandomTestSuite::RandomTestSuite() {
      unsigned short int i;
 
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        this->suite[i] = NULL;
        this->selfCreatedTest[i] = false;
        this->usedTests[i] = false;
      }
      this->random = false;
      this->strictRandomnessCheck = false;
      this->mathFunctions = new MathematicalFunctions();
      this->selfCreatedMaths = true;
      this->error = NoError;
      this->instantiatedTests = 0;
      this->numberOfErrors = 0;
      this->errorTest = RandomTest_NotDefined;
      this->nonRandomTest = RandomTest_NotDefined;
    }
 
    // Constructor, initializes suite and assigns MathematicalFunctions parameter
    RandomTestSuite::RandomTestSuite(MathematicalFunctions* mathFuncObj) {
      unsigned short int i;
 
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        this->suite[i] = NULL;
        this->selfCreatedTest[i] = false;
        this->usedTests[i] = false;
      }
      this->random = false;
      this->strictRandomnessCheck = false;
      this->mathFunctions = mathFuncObj;
      this->selfCreatedMaths = false;
      this->error = NoError;
      this->instantiatedTests = 0;
      this->numberOfErrors = 0;
      this->errorTest = RandomTest_NotDefined;
      this->nonRandomTest = RandomTest_NotDefined;
    }
 
    // Destructor
    RandomTestSuite::~RandomTestSuite() {
      unsigned short int i;
 
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        if (this->suite[i] != NULL) {
          delete this->suite[i];
          this->suite[i] = NULL;
            this->selfCreatedTest[i] = false;
        }
        this->usedTests[i] = false;
      }
      this->random = false;
      this->strictRandomnessCheck = false;
      if (this->selfCreatedMaths) {
        delete this->mathFunctions;
      }
      this->error = NoError;
      this->instantiatedTests = 0;
      this->numberOfErrors = 0;
      this->errorTest = RandomTest_NotDefined;
      this->nonRandomTest = RandomTest_NotDefined;
    }
 
    // ADDING RANDOM TESTS
      
    // Adds a random test to the suite
    void RandomTestSuite::Add(BaseRandomTest* test) {
 
      if (test != NULL) {
        this->suite[test->GetType()] = test;
        this->selfCreatedTest[test->GetType()] = false;
        this->instantiatedTests++;
      }
    }
 
    // Creates and adds a random test to the suite based in the enumerated random tests
    void RandomTestSuite::Add(RandomTests testEnum) {
 
      switch ( testEnum ) {
        case Frequency: 
          if (this->suite[Frequency] == NULL) {
            this->suite[Frequency] = new FrequencyTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case BlockFrequency: 
          if (this->suite[BlockFrequency] == NULL) {
            this->suite[BlockFrequency] = new BlockFrequencyTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case Runs: 
          if (this->suite[Runs] == NULL) {
            this->suite[Runs] = new RunsTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case LongestRunOfOnes: 
          if (this->suite[LongestRunOfOnes] == NULL) {
            this->suite[LongestRunOfOnes] = new LongestRunOfOnesTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case CumulativeSumForward: 
          if (this->suite[CumulativeSumForward] == NULL) {
            this->suite[CumulativeSumForward] = new CumulativeSumForwardTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case CumulativeSumReverse: 
          if (this->suite[CumulativeSumReverse] == NULL) {
            this->suite[CumulativeSumReverse] = new CumulativeSumReverseTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case Rank: 
          if (this->suite[Rank] == NULL) {
            this->suite[Rank] = new RankTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case Universal: 
          if (this->suite[Universal] == NULL) {
            this->suite[Universal] = new UniversalTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case ApproximateEntropy: 
          if (this->suite[ApproximateEntropy] == NULL) {
            this->suite[ApproximateEntropy] = new ApproximateEntropyTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case Serial: 
          if (this->suite[Serial] == NULL) {
            this->suite[Serial] = new SerialTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        case DiscreteFourierTransform: 
          if (this->suite[DiscreteFourierTransform] == NULL) {
            this->suite[DiscreteFourierTransform] = new DiscreteFourierTransformTest(this->mathFunctions);
            this->instantiatedTests++;
          }
          break;
        default:
          break;
      }
      this->selfCreatedTest[testEnum] = true;
    }
 
    // Creates and adds all random tests to the suite 
    void RandomTestSuite::AddAll(void) {
      unsigned short int i;
 
      this->suite[Frequency] = new FrequencyTest(this->mathFunctions);
      this->suite[BlockFrequency] = new BlockFrequencyTest(this->mathFunctions);
      this->suite[Runs] = new RunsTest(this->mathFunctions);
      this->suite[LongestRunOfOnes] = new LongestRunOfOnesTest(this->mathFunctions);
      this->suite[CumulativeSumForward] = new CumulativeSumForwardTest(this->mathFunctions);
      this->suite[CumulativeSumReverse] = new CumulativeSumReverseTest(this->mathFunctions);
      this->suite[Rank] = new RankTest(this->mathFunctions);
      this->suite[Universal] = new UniversalTest(this->mathFunctions);
      this->suite[ApproximateEntropy] = new ApproximateEntropyTest(this->mathFunctions);
      this->suite[Serial] = new SerialTest(this->mathFunctions);
      this->suite[DiscreteFourierTransform] = new DiscreteFourierTransformTest(this->mathFunctions);
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        this->selfCreatedTest[i] = true;
      }
      this->instantiatedTests = NumberOfRandomTests;
 
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddFrequencyTest(void) {
 
      this->suite[Frequency] = new FrequencyTest(this->mathFunctions);
      this->selfCreatedTest[Frequency] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddBlockFrequencyTest(void) {
 
      this->suite[BlockFrequency] = new BlockFrequencyTest(this->mathFunctions);
      this->selfCreatedTest[BlockFrequency] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddRunsTest(void) {
 
      this->suite[Runs] = new RunsTest(this->mathFunctions);
      this->selfCreatedTest[Runs] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddLongestRunOfOnesTest(void) {
 
      this->suite[LongestRunOfOnes] = new LongestRunOfOnesTest(this->mathFunctions);
      this->selfCreatedTest[LongestRunOfOnes] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddCumulativeSumForwardTest(void) {
 
      this->suite[CumulativeSumForward] = new CumulativeSumForwardTest(this->mathFunctions);
      this->selfCreatedTest[CumulativeSumForward] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddCumulativeSumReverseTest(void) {
 
      this->suite[CumulativeSumReverse] = new CumulativeSumReverseTest(this->mathFunctions);
      this->selfCreatedTest[CumulativeSumReverse] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddRankTest(void) {
 
      this->suite[Rank] = new RankTest(this->mathFunctions);
      this->selfCreatedTest[Rank] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddUniversalTest(void) {
 
      this->suite[Universal] = new UniversalTest(this->mathFunctions);
      this->selfCreatedTest[Universal] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddApproximateEntropyTest(void) {
 
      this->suite[ApproximateEntropy] = new ApproximateEntropyTest(this->mathFunctions);
      this->selfCreatedTest[ApproximateEntropy] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddSerialTest(void) {
 
      this->suite[Serial] = new SerialTest(this->mathFunctions);
      this->selfCreatedTest[Serial] = true;
      this->instantiatedTests++;
    }
 
    // Creates and adds defined random test to the suite
    void RandomTestSuite::AddDiscreteFourierTransformTest(void) {
 
      this->suite[DiscreteFourierTransform] = new DiscreteFourierTransformTest(this->mathFunctions);
      this->selfCreatedTest[DiscreteFourierTransform] = true;
      this->instantiatedTests++;
    }
 
    // GETTING RANDOM TESTS
      
    // Gets a random test to the suite based in the enumerated random tests
    BaseRandomTest* RandomTestSuite::GetRandomTest(RandomTests testEnum) {
 
      return this->suite[testEnum];
    }
 
    // Gets defined random test to the suite
    FrequencyTest* RandomTestSuite::GetFrequencyTest(void) {
 
      return (FrequencyTest *)this->suite[Frequency];
    }
 
    // Gets defined random test to the suite
    BlockFrequencyTest* RandomTestSuite::GetBlockFrequencyTest(void) {
 
      return (BlockFrequencyTest *)this->suite[BlockFrequency];
    }
 
    // Gets defined random test to the suite
    RunsTest* RandomTestSuite::GetRunsTest(void) {
 
      return (RunsTest *)this->suite[Runs];
    }
 
    // Gets defined random test to the suite
    LongestRunOfOnesTest* RandomTestSuite::GetLongestRunOfOnesTest(void) {
 
      return (LongestRunOfOnesTest *)this->suite[LongestRunOfOnes];
    }
 
    // Gets defined random test to the suite
    CumulativeSumForwardTest* RandomTestSuite::GetCumulativeSumForwardTest(void) {
 
      return (CumulativeSumForwardTest *)this->suite[CumulativeSumForward];
    }
 
    // Gets defined random test to the suite
    CumulativeSumReverseTest* RandomTestSuite::GetCumulativeSumReverseTest(void) {
 
      return (CumulativeSumReverseTest *)this->suite[CumulativeSumReverse];
    }
 
    // Gets defined random test to the suite
    RankTest* RandomTestSuite::GetRankTest(void) {
 
      return (RankTest *)this->suite[Rank];
    }
 
    // Gets defined random test to the suite
    UniversalTest* RandomTestSuite::GetUniversalTest(void) {
 
      return (UniversalTest *)this->suite[Universal];
    }
 
    // Gets defined random test to the suite
    ApproximateEntropyTest* RandomTestSuite::GetApproximateEntropyTest(void) {
 
      return (ApproximateEntropyTest *)this->suite[ApproximateEntropy];
    }
 
    // Gets defined random test to the suite
    SerialTest* RandomTestSuite::GetSerialTest(void) {
 
      return (SerialTest *)this->suite[Serial];
    }
 
    // Gets defined random test to the suite
    DiscreteFourierTransformTest* RandomTestSuite::GetDiscreteFourierTransformTest(void) {
 
      return (DiscreteFourierTransformTest *)this->suite[DiscreteFourierTransform];
    }
 
    // REMOVING RANDOM TESTS
 
    // Removes a pointed random test from the suite
    void RandomTestSuite::Remove(BaseRandomTest* test) {
      RandomTests randomTest;
 
      randomTest = test->GetType();
      if ((this->suite[randomTest] != NULL) && (this->suite[randomTest] == test)) {
        if (this->selfCreatedTest[randomTest]) {
          delete this->suite[randomTest];
        }
        this->suite[randomTest] = NULL;
        this->selfCreatedTest[randomTest] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes a random test to the suite based in the enumerated random tests
    void RandomTestSuite::Remove(RandomTests testEnum) {
 
      if (this->suite[testEnum] != NULL) {
        if (this->selfCreatedTest[testEnum]) {
          delete this->suite[testEnum];
        }
        this->suite[testEnum] = NULL;
        this->selfCreatedTest[testEnum] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes all random test of the suite 
    void RandomTestSuite::RemoveAll(void) {
      unsigned short int i;
 
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        if (this->suite[i] != NULL) {
          if (this->selfCreatedTest[i]) {
            delete this->suite[i];
          }
          this->suite[i] = NULL;
            this->selfCreatedTest[i] = false;
        }
      }
      this->instantiatedTests = 0;
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveFrequencyTest(void) {
 
      if (this->suite[Frequency] != NULL) {
        if (this->selfCreatedTest[Frequency]) {
          delete this->suite[Frequency];
        }
        this->suite[Frequency] = NULL;
          this->selfCreatedTest[Frequency] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveBlockFrequencyTest(void) {
 
      if (this->suite[BlockFrequency] != NULL) {
        if (this->selfCreatedTest[BlockFrequency]) {
          delete this->suite[BlockFrequency];
        }
        this->suite[BlockFrequency] = NULL;
          this->selfCreatedTest[BlockFrequency] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveRunsTest(void) {
 
      if (this->suite[Runs] != NULL) {
        if (this->selfCreatedTest[Runs]) {
          delete this->suite[Runs];
        }
        this->suite[Runs] = NULL;
          this->selfCreatedTest[Runs] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveLongestRunOfOnesTest(void) {
 
      if (this->suite[LongestRunOfOnes] != NULL) {
        if (this->selfCreatedTest[LongestRunOfOnes]) {
          delete this->suite[LongestRunOfOnes];
        }
        this->suite[LongestRunOfOnes] = NULL;
          this->selfCreatedTest[LongestRunOfOnes] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveCumulativeSumForwardTest(void) {
 
      if (this->suite[CumulativeSumForward] != NULL) {
        if (this->selfCreatedTest[CumulativeSumForward]) {
          delete this->suite[CumulativeSumForward];
        }
        this->suite[CumulativeSumForward] = NULL;
          this->selfCreatedTest[CumulativeSumForward] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveCumulativeSumReverseTest(void) {
 
      if (this->suite[CumulativeSumReverse] != NULL) {
        if (this->selfCreatedTest[CumulativeSumReverse]) {
          delete this->suite[CumulativeSumReverse];
        }
        this->suite[CumulativeSumReverse] = NULL;
          this->selfCreatedTest[CumulativeSumReverse] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveRankTest(void) {
 
      if (this->suite[Rank] != NULL) {
        if (this->selfCreatedTest[Rank]) {
          delete this->suite[Rank];
        }
        this->suite[Rank] = NULL;
          this->selfCreatedTest[Rank] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveUniversalTest(void) {
 
      if (this->suite[Universal] != NULL) {
        if (this->selfCreatedTest[Universal]) {
          delete this->suite[Universal];
        }
        this->suite[Universal] = NULL;
          this->selfCreatedTest[Universal] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveApproximateEntropyTest(void) {
 
      if (this->suite[ApproximateEntropy] != NULL) {
        if (this->selfCreatedTest[ApproximateEntropy]) {
          delete this->suite[ApproximateEntropy];
        }
        this->suite[ApproximateEntropy] = NULL;
          this->selfCreatedTest[ApproximateEntropy] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveSerialTest(void) {
 
      if (this->suite[Serial] != NULL) {
        if (this->selfCreatedTest[Serial]) {
          delete this->suite[Serial];
        }
        this->suite[Serial] = NULL;
          this->selfCreatedTest[Serial] = false;
        this->instantiatedTests--;
      }
    }
 
    // Removes defined random test to the suite
    void RandomTestSuite::RemoveDiscreteFourierTransformTest(void) {
 
      if (this->suite[DiscreteFourierTransform] != NULL) {
        if (this->selfCreatedTest[DiscreteFourierTransform]) {
          delete this->suite[DiscreteFourierTransform];
        }
        this->suite[DiscreteFourierTransform] = NULL;
          this->selfCreatedTest[DiscreteFourierTransform] = false;
        this->instantiatedTests--;
      }
    }
 
    // CHECKING RANDOMNESS
 
    // Tests the BaseCryptoRandomStream untill an error is found with all instantiated random tests and returns the random value
    bool RandomTestSuite::IsRandom(BaseCryptoRandomStream* stream) {
      unsigned short int i;
      
      this->random = true;
      i = this->GetFirstTest();
      if ( this->strictRandomnessCheck ) {
        while ((i < this->GetMaximumNumberOfTests()) && (this->random)) {
          if (this->suite[i] != NULL) {
            this->random &= this->suite[i]->IsRandom(stream);
            if ( ! this->random ) {
              nonRandomTest = this->suite[i]->GetType();
              if (this->suite[i]->GetError() != NoError) {
                errorTest = this->suite[i]->GetType();
                this->numberOfErrors = 1;
              }
            }
          }
          i++;
        }
      }
      else {
        this->ResetUsedTests();
        while ((i < this->GetMaximumNumberOfTests()) && (this->random)) {
          if (this->suite[i] != NULL) {
            if ( stream->GetBitLength() >= this->suite[i]->GetMinimumLength() ) {
              this->random &= this->suite[i]->IsRandom(stream);
              this->usedTests[i] = true;
            }
            if ( ! this->random ) {
              nonRandomTest = this->suite[i]->GetType();
              if (this->suite[i]->GetError() != NoError) {
                errorTest = this->suite[i]->GetType();
                this->numberOfErrors = 1;
              }
            }
          }
          i++;
        }
        if ( ! this->GetUsedTestsNumber() ) {
          this->random = false;
        }
      }
      return this->random;
    }
 
    // Tests the BaseCryptoRandomStream with all instantiated random tests and returns the random value
    bool RandomTestSuite::TestRandom(BaseCryptoRandomStream* stream) {
      unsigned short int i;
      
      this->random = true;
      for ( i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++ ) {
        if (this->suite[i] != NULL) {
          this->random &= this->suite[i]->IsRandom(stream);
          if (!(this->suite[i]->IsRandom())) {
            if (this->suite[i]->GetError() != NoError) {
              if (this->error == NoError)
                this->error = this->suite[i]->GetError();
              else 
                if (this->error != this->suite[i]->GetError())
                  this->error = MultipleErrors;
              numberOfErrors++;
            }
          }
        }
      }
      return this->random;
    }
 
    // INITIALIZE SUITE
      
    // Initializes all random tests in the suite
    void RandomTestSuite::Initialize(void) {
      unsigned short int i;
      
      for ( i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++ ) {
        if (this->suite[i] != NULL) {
          this->suite[i]->Initialize();
        }
        this->usedTests[i] = false;
      }
      this->random = false;
      this->error = NoError;
      this->numberOfErrors = 0;
      this->errorTest = RandomTest_NotDefined;
    }
 
    // Sets Alpha all random tests in the suite
    void RandomTestSuite::SetAlpha(double newAlpha) {
      unsigned short int i;
 
      for (i = 0; i < NumberOfRandomTests; i++)
        if (this->suite[i] != NULL)
          this->suite[i]->SetAlpha(newAlpha);
    }
 
    // GETTING SUITE RESULTS
 
    // Gets the RandomTestSuite random state of the last executed BaseCryptoRandomStream
    bool RandomTestSuite::IsRandom(void) {
 
      return this->random;
    }
 
    // Gets the number of Random Tests that contains the suite
    unsigned short int RandomTestSuite::GetInstantiatedTests(void) {
 
      return this->instantiatedTests;
    }
 
    // Gets the minimum random stream length in bits corresponding
    // to random number test with higher random stream length
    unsigned long int RandomTestSuite::GetMinimumLength(void) {
      unsigned long int minimumMax;
      unsigned short int i;
 
      minimumMax = 0;
      for ( i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++ ) {
        if ( this->Exist((RandomTests)i) ) {
          if ( this->GetRandomTest((RandomTests)i)->GetMinimumLength() > minimumMax ) {
            minimumMax = this->GetRandomTest((RandomTests)i)->GetMinimumLength();
          }
        }
      }
      return minimumMax;
    }
 
    // Gets the corresponding random number test 
    // with higher minimum random stream length in bits 
    RandomTests RandomTestSuite::GetMinimumLengthRandomTest(void) {
      unsigned long int minimumMax;
      unsigned short int i;
      RandomTests randomTest;
 
      minimumMax = 0;
      randomTest = RandomTest_NotDefined;
      for ( i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++ ) {
        if ( this->Exist((RandomTests)i) ) {
          if ( this->GetRandomTest((RandomTests)i)->GetMinimumLength() > minimumMax ) {
            minimumMax = this->GetRandomTest((RandomTests)i)->GetMinimumLength();
            randomTest = (RandomTests)i;
          }
        }
      }
      return randomTest;
    }
 
    // Gets the failed random test in the RandomTestSuite
    RandomTests RandomTestSuite::GetNonRandomTest(void) {
 
      return this->nonRandomTest;
    }
 
    // Gets the RandomTestError error of the last executed BaseCryptoRandomStream
    RandomTestErrors RandomTestSuite::GetError(void) {
 
      return this->error;
    }
 
    // Gets the RandomTest that produced the error of the last executed BaseCryptoRandomStream
    RandomTests RandomTestSuite::GetErrorTest(void) {
 
      return this->errorTest;
    }
 
    // Indicates if a random test object exists in the suite
    bool RandomTestSuite::Exist(RandomTests testEnum) {
 
      return (this->suite[testEnum] != NULL);
    }
 
    // Gets the first random test in the RandomTestSuite
    RandomTests RandomTestSuite::GetFirstTest(void) {
 
      return this->firstTest;
    }
 
    // Gets the number of random tests that can be used in the RandomTestSuite
    RandomTests RandomTestSuite::GetMaximumNumberOfTests(void) {
 
      return NumberOfRandomTests;
    }
 
    // STRICT RANDOMNESS METHODS
 
    // Sets strict randomness checking, if all random tests instantiated in the suite will be verified
    // true: all random tests instantiated in the suite will be verified
    // false: just random tests that can be checked (stream length larger than random test minimum length) will be verified 
    void RandomTestSuite::SetStrictRandomnessCheck(bool strictness) {
 
      this->strictRandomnessCheck = strictness;
    }
 
    // Gets strict randomness checking, if all random tests instantiated in the suite will be verified
    bool RandomTestSuite::GetStrictRandomnessCheck(void) {
 
      return this->strictRandomnessCheck;
    }
 
    // USED TEST METHODS WHEN STRICT RANDOMNESS CHECKING IS DISABLED
 
    // Gets number of random test that has been used in last random test checking
    unsigned short int RandomTestSuite::GetUsedTestsNumber(void) {
      unsigned short int i, number;
 
      number = 0;
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        if ( this->usedTests[i] ) {
          number++;
        }
      }
      return number;
    }
 
    // Gets if enumerated random test has been used in last random test checking
    bool RandomTestSuite::GetUsedTest(RandomTests testEnum) {
 
      return this->usedTests[testEnum];
    }
 
    // Gets if frequency random test has been used in last random test checking
    bool RandomTestSuite::GetUsedFrequencyTest(void) {
 
      return this->usedTests[Frequency];
    }
 
    // Gets if block frequency random test has been used in last random test checking
    bool RandomTestSuite::GetUsedBlockFrequencyTest(void) {
 
      return this->usedTests[BlockFrequency];
    }
 
    // Gets if cumulative sum forward random test has been used in last random test checking
    bool RandomTestSuite::GetUsedCumulativeSumForwardTest(void) {
 
      return this->usedTests[CumulativeSumForward];
    }
 
    // Gets if cumulative sum reverse random test has been used in last random test checking
    bool RandomTestSuite::GetUsedCumulativeSumReverseTest(void) {
 
      return this->usedTests[CumulativeSumReverse];
    }
 
    // Gets if runs random test has been used in last random test checking
    bool RandomTestSuite::GetUsedRunsTest(void) {
 
      return this->usedTests[Runs];
    }
 
    // Gets if longest run of ones random test has been used in last random test checking
    bool RandomTestSuite::GetUsedLongestRunOfOnesTest(void) {
 
      return this->usedTests[LongestRunOfOnes];
    }
 
    // Gets if rank random test has been used in last random test checking
    bool RandomTestSuite::GetUsedRankTest(void) {
 
      return this->usedTests[Rank];
    }
 
    // Gets if universal random test has been used in last random test checking
    bool RandomTestSuite::GetUsedUniversalTest(void) {
 
      return this->usedTests[Universal];
    }
 
    // Gets if approximate entropy random test has been used in last random test checking
    bool RandomTestSuite::GetUsedApproximateEntropyTest(void) {
 
      return this->usedTests[ApproximateEntropy];
    }
 
    // Gets if serial random test has been used in last random test checking
    bool RandomTestSuite::GetUsedSerialTest(void) {
 
      return this->usedTests[Serial];
    }
 
    // Gets if discrete fourier transform random test has been used in last random test checking
    bool RandomTestSuite::GetUsedDiscreteFourierTransformTest(void) {
 
      return this->usedTests[DiscreteFourierTransform];
    }
 
    // Resets all random test "used" signal to false 
    void RandomTestSuite::ResetUsedTests(void) {
      unsigned short int i;
 
      for (i = this->GetFirstTest(); i < this->GetMaximumNumberOfTests(); i++) {
        this->usedTests[i] = false;
      }
    }
 
  }
}