Joomla! Joomla!
DiceLock cipher incorporates Cumulative Sum Reverse random number test to produce randomized-encrypted sequences.
As performance execution is an important issue to encryption we need to know time performance relation between Cumulative Sum Reverse random number test and the symmetric key ciphers implemented in DiceLock.
In this page we show the test performed to get bit stream length and execution time relation. We all know that real execution performance in computers is altered through system interruptions and third party software.
For this analysis we've stopped any third party software like antivirus or software updaters and disconnected the computer from Internet.
At the end of this page you can find the evaluated relevant DiceLock cipher C++ source code used.
Execution output
Plot with RapidMiner
Linear regression with RapidMiner
Linear regression with Excel
Line fit plot with Excel
Relevant C++ Source Code used
Execution environment


with Rapid Miner:

time = 0.000022695548361574 + 0.000000011666714812 * length, Coefficient = 0.992138566158351800

The Coefficient value indicates how well the model fits the data, it's close to 1.0, indicating that we have accounted for almost all of the variability of time (0.992138566158351800) with bit stream length variable.

with Excel:

time = 0,0000226955483615945 + 0,000000011666714812 * length, Multiple R = 0,992138566158346

Which confirms RapidMiner results with a negligible variation.

With these results we'll be able to establish random number test algorithm relations with cipher, decipher algorithms and hash functions (all components of DiceLock).

Data calculation

We compute "time" in seconds depending of the length of the stream being checked for randomness.

Computing "time" comprises the stages:
- initializing random number test,
- setting alpha value to 0.01 (99% conffidence), and
- execute random number test.

In order to establish the relation between stream length in bits with execution time in seconds we have performed the following execution:

- 32.219 streams with lengths from 1.024 bits to 1.000.000 bits, each stream 32 bits longer than the previous one,
- computed random test execution time for each stream with CounterTime class,
- saving to "CumulativeSumReverseTest.csv" file the information: stream length in bits, random test time in seconds for all 32.219 tests performed,
- finally, compute random number test with NIST FIPS 800-22 rev1a test file "data.e" with alpha set to 0.01. We can see that expected pvalue and computed pvalue match.

Execution output:

We can see the last plain streams computed, the length of each bit stream and the time in seconds it took.

At the end alpha is set to 0.01 and NIST "Data.e" is being tested and p-value evaluated.

CumulativeSumReverseTest.csv created file with stream length in bits and execution time in seconds

RapidMiner plot

With CumulativeSumReverseTest.csv we can analyze if it's possible to establish some strong relationship between stream length and execution time in seconds. We've worked with RapidMiner software to see if we can extract some conclusion.

Plot with RapidMiner

The next step performed has been to plot just "time" (Y axis) against stream "length" (X axis). Although the majority of points are over a line, some points are outliers (they are above the line). We can think about these outliers as system interruptions.

It's obvious that execution time has a clear relationship with stream length and that linear regression can be obtained.

With this information we are able to establish a relationship between "time" and stream "length". A linear regression equation can be established to get a final relationship between random number test and cipher algorithms.


RapidMiner software allows to get models on data and establish relationaships between them.

We have taken a two ways approach, establish the linear regression with RapidMiner and verify such linear regression with Microsoft Excel.

RapidMiner linear regression analysis

Linear regression

With the data regarding "time" and stream "length" we have perfomed the linear regression of "time" depending on stream "length".

The result obtained is the following one:

That is:


time = 0.000022695548361574 + 0.000000011666714812 * length


intercept = 0.000022695548361574,

and the slope = 0.000000011666714812,

with a Standard Coefficient of:


Coefficient = 0.992138566158351800


The Coefficient value indicates how well the model fits the data, it's close to 1.0, indicating that we have accounted for almost all of the variability of time (0.992138566158351800) with stream length variable.

Excel linear regression analysis

Microsoft Excel provides for data analysis. We perform the same Linear Regression of the same CumulativeSumReverseTest.csv file in order to check that we get the same results.

Linear regression

In Excel we analyze all 32.219 "time" and stream "length" data samples with Regression and we get the linear regression and ANOVA:

That is:


time = 0,0000226955483615945 + 0,000000011666714812 * length


intercept = 0,0000226955483615945, (Excel result)

intercept = 0.000022695548361574, (RapidMiner result, negligible difference)

slope = 0,000000011666714812, (Excel result)

slope = 0.000000011666714812 (equals RapidMiner result)

And the important statistical information


Multiple R = 0,992138566158346

R Square = 0,984338934458739

Adjusted R Square = 0,984338432774864

Standard Error = 0,000424403696704959


The Coefficient is close to 1.0, indicating that we have accounted for almost all of the variability of time (0,992138566158346) with stream length variable.

coefficient = 0,992138566158346, (Excel result)

coefficient = 0.992138566158351800, (RapidMiner result, negligible difference)

Fit plot

The fit plot of calculated "estimated values" with the linear regression formula (pink line) and the sample data (blue points) shows us that the linear regression formula adjust quite well to real values.

The linear regression formula can be used to estimate time relationships between Cumulative Sum Reverse random number test with cipher algorithms.

Relevant C++ Source Code used

baseCryptoRandomStream.cpp (1)
baseCryptoRandomStream.cpp (2)

Execution environment:

Dell Precision M65
Intel Core 2 CPU T7200 @ 2.00GHz 2.00 GHZ
2,00 GB RAM

Windows Vista Ultimate Service Pack 2
32 bits Operating System

Developed with:
Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM
Microsoft .NET Framework Version 3.5 SP1
Installed Edition: Professional Microsoft Visual C++ 2008 91605-130-0262317-60659
DiceLock release version: Optimization: Maximize Speed (/O2), Favor Fast Code (/Ot)