<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Development and Justification of Techniques for Periodic Quality Control of Random/Pseudorandom Number Generators for Cryptographic Applications ⋆</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Lyudmila Kovalchuk</string-name>
          <email>lusi.kovalchuk@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Oleksii Bespalov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Hanna Nelasa</string-name>
          <email>annanelasa@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>G.E. Pukhov Institute for Modelling in Energy Engineering</institution>
          ,
          <addr-line>General Naumov Str. 15, Kyiv, 03164</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2026</year>
      </pub-date>
      <fpage>117</fpage>
      <lpage>128</lpage>
      <abstract>
        <p>The use of random/pseudorandom number generators with good cryptographic properties is critical for cryptographic applications, especially when these generators are used to generate key data. Using a generator whose outputs do not form a "perfect" random sequence significantly reduces the cryptographic properties of a cryptosystem. Specifically, the system becomes vulnerable to a directed brute-force attack, which allows one to recover the most probable key of a cryptographic algorithm, based on deviation of equiprobable distribution. However, developers of such generators typically focus on engineering, analytical, and statistical quality checks of the proposed generator, and pay virtually no attention to developing effective quality control methods for the generator throughout its lifecycle. This paper aims to fill this gap. Its goal is to develop and validate an effective (in terms of speed and quality) periodic verification of the correct operation of a random/pseudorandom number generator, ensuring its cryptographic properties are preserved. Such testing is necessary for the timely detection of generator operational deviations at the early stages of their occurrence, before their impact becomes critical. This paper develops a periodic generator quality check procedure, called second-level (the first-level verification is performed upon generator adoption). A set of statistical tests for performing this verification is proposed; it is shown that these tests identify various types of generator operational deviations and are independent. It also shows how the results of applying these tests to generator outputs should be processed. As an example of the use of a second-level verification, the results of its application to a standardized generator based on DSTU 7624:2014 "Kalina" are presented.</p>
      </abstract>
      <kwd-group>
        <kwd>random/pseudorandom number generator</kwd>
        <kwd>random sequences</kwd>
        <kwd>statistical tests</kwd>
        <kwd>key data generation</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>The</p>
      <p>NIST</p>
      <p>STS [1] statistical test suite, designed to verify the cryptographic qualities of
random/pseudo-random number generators (RNGs/PRNGs), is a powerful and extremely important
tool. It is mandatory when verifying a newly developed generator before its adoption, or after a
major overhaul of a hardware generator [2].</p>
      <p>However, in addition to a one-time inspection upon adoption, hardware generators require
additional periodic control. Hardware RNG testing requires more complex approach than others
classes of digital devices. This is due to the following factors.
1. In contrast to traditional approach to functionality verification, for hardware RNG it is
impossible to organize verification according to the black box approach [3], or using known test
input-output values, or like that.</p>
      <p>2. The occurrence of a failure in hardware RNG functioning, causing incorrect output
sequences, usually will not be immediately detected.</p>
      <p>3. Hardware generators are significantly vulnerable to misuse or to use in inappropriate
physical conditions [4], or to the deterioration of the quality of the physical source of randomness
[5].</p>
      <p>Thus, for hardware generation of random/pseudo-random sequences with a given level of
security, it is necessary to perform periodic (once a day, a week, etc.) verifications of the
correctness of its functioning, assessing the quality of the output sequences.</p>
      <p>At the same time, periodic checking should not be as complicated and resource-consuming as
the verification upon adoption. This is due to the fact that periodic checking is applied to such a
RNG/PRNG, which, firstly, has good cryptographic properties, and secondly, has passed
preliminary engineering checks for reliability of functioning. In addition, periodic checking should
be applied to a working RNG/PRNG without stopping it, therefore it should occur almost in real
time.
the RNG/PRNG Verification Strategy defined in [1] and improved in [6]. As in lightweight
cryptology, this analogue should, on the one hand, require significantly less time, and on the other
hand, perform less detailed verification.</p>
      <p>The structure of the article is the follows. In Section 2 we consider articles on the topic, analyze
directions of their investigations. In the Section 3 the main results are given, namely: detailed
description of tests proposed for second-level verification; justification of the tests independence;
application of proposed second-level verification for standardized PRNG. We conclude with Section
4, summarizing the usage of our results and describing the possible direction of future
investigations.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related work</title>
      <p>The vast majority of contemporary works, devoted to issues related to RNG/PRNG, can be divided
into the following clusters by topic.</p>
      <sec id="sec-2-1">
        <title>2.1. The methods of RNG/PRNG creation or improvement</title>
        <p>Thus, in [7] a number of methods for constructing high-quality RNG by harnessing the inherent
noise properties of multistage ring oscillators and using fast Fourier transformation-based noise are
proposed. The authors verify the statistical properties of their proposed RNG using a test suite [1]
and obtain results confirming its cryptographic qualities.</p>
        <p>The authors of [8] consider memristor TRNGs (True Random Number Generators) obtained
using various entropy sources for producing high quality random numbers or sequences, analyze
their strengths and weaknesses, and show that memristor TRNGs stand out due their simpler
circuits and lower power consumption in comparison with CMOS (Complementary
Metal-OxideSemiconductor)- based TRNGs.</p>
        <p>The work [9] is devoted to the evaluation of the theoretical bound for the min-entropy of the
output random sequence through the very efficient entropy accumulation using only bitwise XOR
operations, under the condition that the inputs from the entropy source are independent. The
obtained theoretical results were applied to the quantum random number generator that uses dark
shot noise arising from image sensor pixels as its entropy source.</p>
        <p>Chaos Based Cryptography Pseudo-Random Number Generator Template with Dynamic State
Change is proposed in [10]. It is also analyzed using NIST STS tests [1]. Obtained results show that
chaotic maps can be successfully used as a building blocks for cryptographic random number
generators.</p>
        <p>The work [11] deals with the method of Improving the Statistics Qualities of Pseudo Random
Number Generators. The authors present a new non-linear filter design of PRNG that improves the
output sequences of common pseudo random generators in terms of statistical randomness .</p>
        <p>At last, [12] proposes a variety of randomness extraction methods to post-process the output of
random number generators and evaluated their impacts on the statistical properties. The findings
show that all proposed post-processing methods improved the statistical properties of RNG/PRNG.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. New methods for verifying the cryptographic qualities of a generator or applying known methods to widely used generators</title>
        <p>In [13], the use of Neural Networks for the assessment of the quality and hence security of several
Random Number Generators is considered. The authors focus both on the vulnerability of classical
Pseudo Random Number Generators, such as Linear Congruential Generators and the RC4
algorithm, and extend their analysis to non-conventional data sources, such as Quantum Random
Number Generators based on Vertical-Cavity Surface-Emitting Laser. Their findings reveal the
potential of NNs to enhance the security of RNGs, along with highlighting the robustness of certain
QRNGs, in particular the VCSEL-based (Vertical-Cavity Surface-Emitting Laser) variants.</p>
        <p>The work [14] proposes a rough sets based analyzing system to analyze the quality of
Pseudorandom Number Generator, while the design of generators is outside the scope of this
paper.</p>
        <p>The special of RNGs, namely Physical Prime Random Number Generator Based on Quantum
Noise is considered in [15]. Such generators have not yet been explored, and in this work the
authors experimentally implement and characterize a vacuum-based probabilistic prime number
generation scheme with an error probability of about 3.5×10 .</p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Review articles with comprehensive and comparative analysis of different well-known RNG or PRNG</title>
        <p>The good example of such articles is [16], which reviews the performance and statistical quality of
some well known algorithms for generating pseudo random numbers. For completeness, we should
also mention such articles as [17], [18], [19].</p>
        <p>However, as the study of these works showed, none of them considers the full process of
functioning of the RNG/PRNG during its lifetime, in particular the issue of verifying the
cryptographic qualities of the RNG/PRNG at different stages of its functioning.</p>
        <p>In [5] and [20], the necessity to use three different types of RNG/PRNG quality verification was
justified. The first-level verification is performed during the adoption process. The second-level
verification is performed periodically at certain specified intervals to prevent usage of the
RNG/PRNG with a slight (but dangerous) degradation of its cryptographic properties and to detect
such degradation at an early stage. The third-level verification is a continuous verification aimed at
instantly detecting significant failures in operation.</p>
        <p>For the first level verification, an Improved Strategy for RNG/PRNG Quality Verification was
proposed in [6 -3 simple tests (like chi-square
and maximal series tests) which may detect significant deviations from equiprobable distribution,
or significant symbol dependency, or different physical faults. But the question about the
secondlevel (periodic) verification is still opened, and we are going to focus on it in this paper.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Our results. Description of criteria and justification for the chosen statistics. P-values calculation</title>
      <p>The object of this work is process of random/pseudorandom numbers and sequences generation.</p>
      <p>The main purpose of it is to create an efficient second-level verification, which can be
periodically applied to RNG/PRNG to verify correctness of its functioning. Here
we understand fast procedure, which is able to detect different dangerous deviation in
its work on their early stage, while these deviations become essentially dangerous.</p>
      <p>For the second-level verification, it is sufficient to use a significantly smaller tests suite than for
the first-level one. This is explained by the fact that at this stage it is not necessary to conduct a
comprehensive analysis of the RNG/PRNG, but only to make sure that it functions correctly. But
the technique for test results processing can be the same as in the Improved Strategy [6].</p>
      <p>The requirements for the tests suite for the second level verification are as follows:
•
•
•
•
tests should be independent;
tests must be selected in a such way, that the obtained set contains tests that can check all
major types of deviations from randomness, such as: violation of symbol equiprobability;
presence of dependencies between symbols; presence of a symbol's dependence on its place
in the sequence; etc.;
tests should be quick and easy to perform;
the number of tests should be as minimal as possible.</p>
      <p>Based on the above requirements, a set of statistical tests will be proposed below, their choice
will be justified, and what deviations each test detects will be shown. We will call this set of tests
OPTIMA-5 according to the number of tests in the set. In order to make it possible to apply the
Improved Strategy to the test results, an appropriate algorithm for calculating the P-value
corresponding to the obtained statistic will be given for each test.</p>
      <p>In what follows, we will use the hypothesis H0
from the RNG/PRNG is an implementation of a true random sequence, i.e. sequence of
equiprobable,
hypothesis H1 is complex and may be formulated as H0 is not true . The tests given below are
aimed at testing the hypothesis H .</p>
      <p>0</p>
      <sec id="sec-3-1">
        <title>3.1. Monobit 2 -test</title>
        <p>alphabet A = a1 ,...,aN  of the size .</p>
        <p>Then the random variable
Let  i in=1 be a sequence of independent random variables, equiprobably distributed on the
 2 = N (Mi − npi )2 = N Mi2 − n ,</p>
        <p>i=1 npi i=1 npi
where pi = P l = ai  , i N , l n , Mi is the number of symbols ai in the sequence  i in=1 , will
asymptotically have a  2 -distribution with -1 degrees of freedom.</p>
        <sec id="sec-3-1-1">
          <title>Under the condition of equiprobable distribution of variables i (according to H0 ), we have</title>
          <p> 2 =</p>
          <p>N N</p>
          <p> Mi2 − n .</p>
          <p>n i=1
pi = N1 and</p>
          <p>
            If
2 for a given significance level  is calculated
from the formula F(2 ) = 1 − , where F ( x ) is a 2 -distribution function with -1 degrees of
freedom (the value of the distribution function is tabulated, see, for example, [21]).
(
            <xref ref-type="bibr" rid="ref1">1</xref>
            )
          </p>
          <p>2 2 approaches normal distribution with parameters
N(x; 2(N −1) + 1, 1) , and the limit value of the statistic 2 for a given significance level  may be
found from the formula 2 = 1 ( 2(N −1) −1 + z )2 , where (z ) =1− and (x) is the standard
2
normal distribution function (the value of the distribution function is tabulated, see for example
[22].</p>
          <p>For example, for  = 16 and =0.001, we have 2 =37.7; for N =2 and =0.01, we have</p>
        </sec>
        <sec id="sec-3-1-2">
          <title>A sequence passed the test with a significance level  if  2  2 .</title>
          <p>P-value calculation.</p>
          <p>If N −1  30 , then the P-value corresponding to the calculated value of the statistic
 2 = N N Mi2 − n is calculated as P2 = 1 − F( 2) , where F ( x ) is  2 -distribution function with
n i=1
-1 degrees of freedom.</p>
          <p>If N −1  30 , then the P-value corresponding to the calculated value of the statistic
 2 = N N Mi2 − n is calculated with the next steps:</p>
          <p>n i=1
- calculate the value z = 2 2 − 2(N −1) −1 ;
- calculate the P-value from the equation P2 = 1− (z) , where (x) is the standard normal
distribution function (the value of the distribution function is tabulated, see [22]).</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Bigram 2-test</title>
        <p>n
Let  i i=1 be a sequence of independent random variables, equiprobably distributed on the
alphabet A = a1 ,...,aN  of the size .</p>
        <p>n
Then the sequence  =   2 , where  j = (2 j−1 ,2 j ) , consisting of non-overlapping bigrams,
j j=1
is a sequence of independent random variables that take values in the alphabet A A of size N2 .
Then the random variable</p>
        <p>N (Mij − kpij )2
2 = 
i,j=1 kpij</p>
        <p>N M2
=  ij − k ,
i,j=1 kpij
where pij = Pvl = (ai ,aj ) , k = n , Mij is the number of all bigrams (ai ,aj ) A A in the
2
sequence , will asymptotically have a  2 -distribution with N2 −1 degrees of freedom.</p>
        <p>Under the condition of equiprobable distribution of variables i , the corresponding bigrams
will also have equiprobable distribution, i.e. pij = 12 , therefore</p>
        <p>N
2 = N2 N Mi2j − k .</p>
        <p>k i,j=1</p>
        <p>
          If N −1  30 , then the limit value of the statistic 2 for a given significance level  is
calculated from the formula F(2 ) = 1 − , where F ( x ) is a 2 -distribution function with N2 −1
degrees of freedom.
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )
If N2 − 1  30 , then the distribution
        </p>
        <p>2 2 approaches normal N(x; 2(N2 −1) +1, 1) , and the
limit value of the statistic 2 for a given significance level  may be found from the formula
2 = 1 ( 2(N2 −1) −1 + z )2 , where (z ) =1− and (x) is the standard normal distribution
2
function.</p>
        <p>For example, for N = 16 and  = 0.01 we have 2 = 309.781 ; for N =2 and =0.01, we have
2 = 6.63.</p>
        <p>A sequence passed the test with a significance level  if X2  X2 .</p>
        <p>P-value calculation.</p>
        <p>If N −1  30 , then the P-value corresponding to the calculated value of the statistic
2 = N2 N Mi2j − k is calculated as P2 = 1 − F(2) , where F ( x ) is  2 -distribution function with
k i,j=1
N2 −1 degrees of freedom.</p>
        <p>If N −1  30 , then the P-value corresponding to the calculated value of the statistic
 2 = N N Mi2 − n is calculated with the next steps:</p>
        <p>n i=1
- calculate the value Z = 2 2 − 2(N2 −1) −1 ;
- calculate the P-value from the equation P2 = 1 − (Z) , where (x) is the standard normal
distribution function (the value of the distribution function is tabulated, [22]).</p>
        <p>The two tests described above check the equiprobability of distributions of symbols and
bigrams. Note that the combination of these tests also checks pairwise symbol dependencies.</p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Number of runs test</title>
        <p>alphabet A of the size .</p>
        <p>Then
Let  i in=1 be a sequence of independent random variables, equiprobably distributed on the
n−1
Define a random variable G = I(i+1 i ) + 1 (the number of series in the sequence  i in=1 ).
n</p>
        <p>i=1
n−1 n−1 N − 1</p>
        <p>MGn = i=1 MI + 1 = (n − 1)(1 − N1 ) + 1 ; DGn = i=1 DI = (n − 1)( N2 ) .</p>
        <sec id="sec-3-3-1">
          <title>Since Gn is a sum of identically distributed, independent random variables, the random variable</title>
          <p>G − MGn
G = n</p>
          <p>DGn</p>
          <p>
            G − MGn → N(
            <xref ref-type="bibr" rid="ref1">0,1</xref>
            ) when n →  .
has asymptotically the standard normal distribution, i.e. n
DGn
Therefore, for the chosen significance level  obtain:
 G − MGn  G  = P(G  G  G  −G ) = P(G  G ) + P(G  −G ) =
          </p>
          <p>
 = P  n
 DGn </p>
          <p>= 1− F(G ) + F(−G ) = 1 −F(G ) +1 −F(G ) = 2 −2F(G ) ,
where F(x) is the standard normal distribution function.</p>
          <p>
            A sequence passed the test with a significance level  if
(
            <xref ref-type="bibr" rid="ref3">3</xref>
            )
where G is calculated from the equation F(G ) = 1 −
For example, for =0.01 we have G =2.58.
          </p>
          <p>P-value calculation.</p>
          <p>G − MGn  G ,
n</p>
          <p>DGn
from the equation PG = 2(1 − F(G)) , where F ( x ) is the function of the standard normal
distribution.</p>
          <p>The number of runs test checks the absence of dependencies between the symbols. For example,
if the probability of changing the next symbol is greater than ½, then the number of series will be
too large; otherwise, if this probability is small, too long series will appear, and the number of
series will be small.</p>
        </sec>
      </sec>
      <sec id="sec-3-4">
        <title>3.4. Places of symbols test</title>
        <p>Let  n</p>
        <p>i i=1 be a sequence of independent random variables, equiprobably distributed on the
alphabet A = a1 ,...,aN  of the size .</p>
        <p>n−1
Let us define a random variable R =  iI( i = ) (the sum of the positions of the symbol v  A
i=1
i in=1 ). Then
in the sequence  </p>
        <p>MR = niP(i = ) = n(n + 1) , DR = ni2DI( i = ) ,</p>
        <p>i=1 2N i=1
since I(i = ) are independent random variables with variance
and for sufficiently large n</p>
        <p>DI(i = ) = MI2(i = ) −(MI(i = ))2 = MI(i = ) −(MI(i = ))2 =
= MI(i = )(1 − MI(i = )) =</p>
        <p>N −1</p>
        <p>N2 ,</p>
        <p>DR = i=n1 i2 NN−21 = NN−21  2n3 + 36n2 + n = NN−21  n(n −1)6(2n +1)  NN−21  n33 .</p>
        <p>Then</p>
        <p>2  R −
 R − MR  = 
 DR 
(N3−N12)n3  Rn − n2+N1 2 n2  3nN  Rn − n2+N1 2 .</p>
        <p>A) are independent, so (for sufficiently large n) the
R − MR</p>
        <p>DR
distribution of the quantity</p>
        <p>
          can be considered as N(
          <xref ref-type="bibr" rid="ref1">0,1</xref>
          ). Therefore, the limiting
distribution of the sum of their squares is the  2 -distribution. Therefore, we can assume that the
variable
has  2 -distribution with degrees N −1 of freedom and for the chosen significance level  the limit
statistics
from the formula F(2 ) = 1 − , where F ( x ) is a 2 -distribution function with -1 degrees of
freedom (the value of the distribution function is tabulated).
        </p>
        <p>If -1 30, then the distribution</p>
        <p>2 2 approaches normal N(x; 2(N −1) + 1, 1) , and the limiting
value of the statistic 2 for a given level of significance is found from the formula
2 = 1 ( 2(N −1) −1 + z )2 , where (z ) =1− , (x) is a function of the standard normal
2
distribution.</p>
        <p>For example, for N = 16 and  = 0.01 we have 2 = 30.58 ; for N = 16 and =0.001, we have
2 = 37.7</p>
        <sec id="sec-3-4-1">
          <title>A sequence passed the test with a significance level  if  2  2 .</title>
          <p>P-value calculation.</p>
          <p>If N −1  30 , then the P-value corresponding to the calculated value of the statistic
T = 3N N−1  R − n2+N1 2 is calculated as PT = 1 − F(T) , where F ( x ) is  2 -distribution function with
n  =0  n
-1 degrees of freedom.</p>
          <p>If N −1  30 , then the P-value corresponding to the calculated value of the statistic
T = 3N N−1  R − n2+N1 2 is calculated with the next steps:</p>
          <p>n  =0  n
- calculate the value z = 2T − 2(N − 1) − 1 ;
- calculate the P-value as PT = 1 − (z) , where (x) is the standard normal distribution function
(the value of the distribution function is tabulated).</p>
          <p>This test checks the dependence of a symbol on its position in a sequence. For example, it can
detect any periodic or monotonic trends.</p>
        </sec>
      </sec>
      <sec id="sec-3-5">
        <title>3.5. Test of inversions</title>
        <p>Let  i in=1 be a sequence of independent random variables, equiprobably distributed on the
alphabet A of the size .</p>
        <p>We assume that n = 2l (otherwise we discard the last symbol of the sequence).</p>
        <p>Build an auxiliary sequence  i = I2i−1 2i  , i = 1,l , and calculate</p>
        <p>2N 
q = P ( i = 0) = 1 + 1 , p = P ( i = 1) = 1 − 1 ,</p>
        <p>
          2 2N 2 2N
M i = 1 − 1 , D i =
2 2N
1 − 1 , i = 1,l .
4 4N2
(
          <xref ref-type="bibr" rid="ref4">4</xref>
          )
l
Define the random variable In =  i (the number of inversions, without overlapping, in the
i=1
sequence  i in=1 ). Then
        </p>
        <p>MIn = l  21 − 21N  , DIn = l  41 − 4N12  .</p>
        <sec id="sec-3-5-1">
          <title>Since In is the sum of identically distributed, independent random variables, then the variable</title>
          <p>I − MIn
I = n</p>
          <p>DIn
has asymptotically standard normal distribution. Therefore, for the chosen significance level 
the next equality holds:
 I − MIn  I  = 2 − 2F(I ) ,</p>
          <p>
 = P  n</p>
          <p> DIn 
where F(x) is the standard normal distribution function.</p>
          <p>A sequence passed the test with a significance level  if In − MIn  I , where I is calculated
DIn
from the equation F(I ) = 1 −
 .</p>
          <p>2
For example, for =0.01 we have I =2.58.</p>
          <p>P-value calculation.</p>
          <p>I − MIn is calculated as
The P-value corresponding to the calculated value of the statistic I = n
DIn
PI = 2 (1 − F(I)) , where F ( x ) is the function of the standard normal distribution.</p>
          <p>Like the series test, this test detects dependencies between symbols, but of a different nature.</p>
          <p>It should be noted that, in general situation, a maximum length run test can be added to the
above-described set of tests. However, for the second-level verification, it is unnecessary, since
such a test is performed continuously according to the third-level verification.</p>
        </sec>
      </sec>
      <sec id="sec-3-6">
        <title>3.6. Independence of tests in the OPTIMA-5 set</title>
        <p>To check the independence of the tests of this set, two methods were used: (i) using the normal
distribution [23]; (ii) using Chernov's inequality [24], both with the significance level  = 0.01 . The
number of sequences which passed all tests is T = 296.</p>
        <p>The significance level for checking hypothesis about independence is A = 0.0001 . The following
results were obtained.</p>
        <p>Independence verification using normal distribution: credential interval is calculated as
W1 , W2  , where


W1 = max 0, (1 − )5 − 4




W2 = min1, (1 − )5 + 4 


(1 − )5 (1− (1− )5 )  = 0.9 ,
300


(1 − )5 (1 − (1 − )5 ) </p>
        <p>
           = 1 .
300 

As T W1 , W2  , the hypothesis about tests independence is accepted.
(
          <xref ref-type="bibr" rid="ref5">5</xref>
          )
        </p>
        <p>Independence verification using Chernov's inequality: credential interval is calculated as
V1 , V2  , where</p>
        <p>V = max0,  − A = 193 and V2 = min1,  + A = 300 , with  = n(1 − )m ,  A =
1
As T V1 , V2  , the hypothesis about tests independence is accepted.
3 ln 2 .
 A</p>
        <p>Hence, both methods make the same decision and we may consider these tests to be mutually
independent.
It should be noted that, in general situation, a maximum length run test can be added to the
abovedescribed set of tests. However, for the second-level verification, it is unnecessary, since such a test
is performed continuously according to the third-level verification.</p>
        <p>To confirm the practical usage of the Improved Strategy for application in second-level PRNG
verification, we applied the verification to the PRNG described in Appendix A of DSTU 9041:2020
[23]. Note that Improved Strategy was described in details in [6], therefore, we only note here that
it verifies the following requirements:</p>
        <p>- equiprobable distribution of P-values for each test (checked using limit chi-square
distribution);
- the proportion of sequences that passed each test (checked using limit normal distribution);
- the number of sequences that passed all tests (checked using limit normal distribution).</p>
        <p>All tests from OPTIMA-5 were applied to 300 sequences, obtained from PRNG mentioned above.
Then for each test distribution of 300 corresponding P-values was checked using chi-square test
with significance level A = 0.0001 . Next, for each test the proportion of adopted sequences were
checked, using limit normal distribution to calculate the edges of credential interval with
significance level A = 0.0001 . At last, the proportion of sequences passed all tests was checked,
using limit normal distribution to calculate the edges of credential interval with significance level
A = 0.0001 .</p>
        <p>1. Distribution of P-values</p>
        <p>In conditions, described above, the limit statistics for chi-square criterion is 33.71995. Based of
obtained P-values, the next statistics were calculated (Table 1):</p>
        <p>Final decision: PRNG from Appendix A of DSTU 9041:2020 is adopted with Improved Strategy.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion and discussion</title>
      <p>The article proposed new technique for second-level verification of the cryptographic quality of
RNG/PRNG, intended for key generation. The task of the second-level verification is to detect
faults in RNG/PRNG before these faults become critical and dangerous from the cryptographic
point of view. This second-level verification consists of 5 tests, which are detailed described in this
work. For each test the simple algorithm to calculate corresponding P-value is given, because
second-level verification uses the set of obtained P-values to make decision about RNG/PRNG
quality. As part of justification of the set of tests, chosen for this verification, we proved that these
tests are in dependent using two different methods: one is based on limit normal distribution, the
second is based on Chernoff inequality. Both methods made decision about tests mutual
independence.</p>
      <p>To demonstrate practical usage of the second-level verification, we applied it to standardized
PRNG, and obtained the expected result: PRNG was accepted.</p>
      <p>As the follow direction of investigation, we consider justification of the value of time interval
between second-level verifications, based on the nature of the generator, its characteristics,
supposed variant of application and other factors.</p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgements</title>
      <p>The results of this work were obtained within the project 2023.04/0020 Development of methods
and layout of the "DEMETRA" ARM for constant and periodic control of the functioning of
cryptographic applications using statistical methods.</p>
    </sec>
    <sec id="sec-6">
      <title>Declaration on Generative AI</title>
      <p>
        The authors have not employed any Generative AI tools.
[6] Kovalchuk, L., Nelasa, H., Rodinko, M., Bespalov, O. "A new extended strategy of processing of
statistical testing results" CEUR Workshop Proceedings, 2024, 3933, pp. 158 167, ISSN
16130073 Publisher CEUR-WS https://ceur-ws.org/Vol-3933/Paper_12.pdf
[7] Singh V, Hasan MS, Azeemuddin S. "A High-Quality Random Number Generator Using
Multistage Ring Oscillators and Fast Fourier Transform-Based Noise Extraction" Eng. 2024;
5(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ):433-446. https://doi.org/10.3390/eng5010023
[8] Zhao X, Chen L-W, Li K, Schmidt H, Polian I, Du N. "Memristive True Random Number
Generator for Security Applications" Sensors, 2024; 24(15):5001.
https://doi.org/10.3390/s24155001
[9] Choi Y, Yeom Y, Kang J-S. Practical Entropy Accumulation for Random Number Generators
with Image Sensor-Based Quantum Noise Sources. Entropy. 2023; 25(7):1056.
https://doi.org/10.3390/e25071056
[10] Datcu O, Macovei C, Hobincu R. Chaos Based Cryptographic Pseudo-Random Number
Generator Template with Dynamic State Change. Applied Sciences. 2020; 10(
        <xref ref-type="bibr" rid="ref2">2</xref>
        ):451.
https://doi.org/10.3390/app10020451
[11] Álvarez, Rafael, Francisco Martínez, and Antonio Zamora. "Improving the Statistical Qualities
of Pseudo Random Number Generators" Symmetry 14 (2022), no. 2: 269.
https://doi.org/10.3390/sym14020269
[12] Foreman C, Yeung R, Curchod FJ. "Statistical Testing of Random Number Generators and
Their Improvement Using Randomness Extraction" Entropy. 2024; 26(12):1053.
https://doi.org/10.3390/e26121053
[13] Luis Crespo, José and González-Villa, Javier and Gutiérrez, Jaime and Valle, Angel. "Assessing
the quality of random number generators through neural networks" Machine Learning:
Science and Technology, IOP Publishing, volume 5 (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ), (2024),
https://dx.doi.org/10.1088/26322153/ad56fb
[14] Aye Myat Nyo et al., "Quality analysis of Pseudorandom Number Generator using rough sets,"
2010 2nd International Conference on Education Technology and Computer, Shanghai, China,
(2010):V2-338-V2-342, doi: 10.1109/ICETC.2010.5529372.
[15] Ferreira MJ, Silva NA, Pinto AN, Muga NJ. Statistical Validation of a Physical Prime Random
Number Generator Based on Quantum Noise. Applied Sciences. 2023, 13(23):12619.
https://doi.org/10.3390/app132312619
[16] Preez V., Johnson M., Leist A., Hawick Ken. "Performance and Quality of Random Number
      </p>
      <p>Generators." Technical Report CSTN-122 (2011).
[17] Deshmukh Shrutika, Damle Bhagyashree, Kottur Suhasini. "Review of Random Number
Generation." International Journal of Current Trends in Engineering &amp; Research (IJCTER)
(2017) https://doi.org/10.13140/RG.2.2.21227.62248.
[18] Crocetti, Luca, Pietro Nannipieri, Stefano Di Matteo, Luca Fanucci, and Sergio Saponara.
"Review of Methodologies and Metrics for Assessing the Quality of Random Number
Generators." Electronics 12, no. 3(2023): 723. https://doi.org/10.3390/electronics12030723
[19] Priyanka, Hussain Imran, Khalique Aqeel. "Random Number Generators and their</p>
      <p>
        Applications: A Review". IJRECE VOL 7 (2019): 1777-1781.
[20] Bespalov O., Kovalchuk L., Klimenko T., "New methods for testing random/pseudo-random
sequence generators at different stages of their functioning" Èlektron. model. 2025, (
        <xref ref-type="bibr" rid="ref5">5</xref>
        ).
[21]
Chi
      </p>
      <p>Turney. Revised on June 21, (2023). URL:
https://www.scribbr.com/statistics/chi-squaredistribution-table/
[22] Standard Normal Distribution Table. Copyright © 2023 Rod Pierce URL:
https://mathsisfun.com/data/standard-normal-distribution-table.html
[23] DSTU 9041:2020 Information technologies. Cryptographic information security. Short message
encryption algorithm based on twisted Edwards elliptic curves, 2020.
URL: https://online.budstandart.com/ua/catalog/doc-page.html?id_doc=90523</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L.E.</given-names>
            <surname>Bassham</surname>
          </string-name>
          <string-name>
            <given-names>III</given-names>
            ,
            <surname>A.L. Rukhin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Soto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.R.</given-names>
            <surname>Nechvatal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.E.</given-names>
            <surname>Smid</surname>
          </string-name>
          , E.B.
          <article-title>Barker and others. "A statistical test suite for random and pseudorandom number generators for cryptographic applications"</article-title>
          ,
          <source>NIST Special Publication</source>
          <volume>800</volume>
          -22,
          <string-name>
            <surname>Revision</surname>
            <given-names>1a</given-names>
          </string-name>
          , (
          <year>2010</year>
          ). URL: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-
          <fpage>22r1a</fpage>
          .pdf
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <source>[2] Company "IIT"</source>
          .
          <article-title>Information protection. Complexes and mechanism of information protection</article-title>
          .
          <source>Hardware RNG "Gryada-3"</source>
          https://iit.com.ua/index.php
          <article-title>?page=itemdetails&amp;p=3&amp;gtype=1&amp;type=1&amp;id=47</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <article-title>[3] Black box</article-title>
          . https://en.wikipedia.org/wiki/Black_box
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Lucian</given-names>
            <surname>Constantin</surname>
          </string-name>
          .
          <article-title>"IoT devices have serious security deficiencies due to bad random number generation" (</article-title>
          <year>2021</year>
          ) https://www.csoonline.com/article/571183/iot-devices
          <article-title>-have-serioussecurity-deficiencies-due-to-bad-random-number-generation</article-title>
          .html
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Rui</given-names>
            <surname>Wang</surname>
          </string-name>
          , Georgios Selimis, Roel Maes,
          <string-name>
            <given-names>Sven</given-names>
            <surname>Goossens</surname>
          </string-name>
          .
          <article-title>"Long-term continuous assessment of SRAM PUF and source of random numbers" Cryptography and Security (cs</article-title>
          .
          <source>CR)</source>
          (
          <year>2020</year>
          ) https://doi.org/10.48550/arXiv.
          <year>2007</year>
          .15909
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>