Abstract
Linear complexity test included in the NIST test suite only checks whether or not the observed linear complexity is close to the expected linear complexity. To take full advantage of the information of the linear complexity profile, we propose two randomness tests including a jump test based on the jump complexity, i. e., the number of changes in the linear complexity profile of a sequence, and a hop test checking the sum of jump heights at intervals. By using an iterative algorithm we calculate some necessary statistical measures of a random sequence of length M, and combining with hypothesis test we determine whether a given binary sequence is random or not. Moreover, we provide the explicit formulae of the expectation and the variance of the statistical measure of the hop test. The computational complexity of the jump test and the hop test is the same as that of the linear complexity test. Additionally, we provide a type of sample which, having passed all tests in the NIST test suite, is rejected by the jump test and hop test. So the proposed tests deserve to be considered.




Similar content being viewed by others
References
A statistical test suite for random and pseudorandom number generators for cryptographic applications, special publication 800-22. Tech. rep
Carter, G.D.: Aspects of local linear complexity. Ph. D. thesis, University of London (1989)
Mauduit, C., Sárközy, A.: On finite pseudorandom binary sequences i: Measure of pseudorandomness, the legendre symbol. Acta Arithmetica 82(4), 365–377 (1997)
Hamano, K., Sato, F., Yamamoto, H.: A new randomness test based on linear complexity profile. IEICE Transactions 92–A(1), 166–172 (2009)
Cassaigne, J., Mauduit, C., Sarkozy, A.: On finite pseudorandom binary sequences vii: The measures of pseudorandomness. Acta Arithmetica 103(2), 97–118 (2002)
Massey, J.L.: Shift-register synthesis and BCH decoding. IEEE Trans. Information Theory 15(1), 122–127 (1969)
Mérai, L., Rivat, J., Sárközy, A.: The measures of pseudorandomness and the NIST tests. In: Number-Theoretic Methods in Cryptology - First International Conference, NuTMiC 2017, Warsaw, Poland, September 11-13, 2017, Revised Selected Papers, pp. 197–216 (2017)
Niederreiter, H.: Sequences with almost perfect linear complexity profile. In: Advances in Cryptology - EUROCRYPT ’87, Workshop on the Theory and Application of of Cryptographic Techniques, Amsterdam, The Netherlands, April 13-15, 1987, Proceedings, pp. 37–51 (1987)
Niederreiter, H.: The probabilistic theory of linear complexity. In: Advances in Cryptology - EUROCRYPT ’88, Workshop on the Theory and Application of of Cryptographic Techniques, Davos, Switzerland, May 25-27, 1988, Proceedings, pp. 191–209 (1988)
Niederreiter, H.: Keysystem sequences with a good linear complexity profile for every strating point. In: Advances in Cryptology - EUROCRYPT ’89, Workshop on the Theory and Application of of Cryptographic Techniques, Houthalen, Belgium, April 10-13, 1989, Proceedings, pp. 523–532 (1989)
Niederreiter, H.: The linear complexity profile and the jump complexity of keystream sequences. In: Advances in Cryptology - EUROCRYPT ’90, Workshop on the Theory and Application of of Cryptographic Techniques, Aarhus, Denmark, May 21-24, 1990, Proceedings, pp. 174–188 (1990)
Rueppel, R.A.: Linear complexity and random sequences. In: Advances in Cryptology - EUROCRYPT ’85, Workshop on the Theory and Application of of Cryptographic Techniques, Linz, Austria, April 1985, Proceedings, pp. 167–188 (1985)
Rueppel, R.A.: Analysis and Design of Stream Ciphers. Springer-Verlag, Berlin, Germany (1986)
Wang, M.: Cryptographic aspects of sequence complexity measures, Ph.D. dissertation. ETH Zurich (1988)
Wang, M.: Linear complexity profiles and continued fractions. In: Advances in Cryptology - EUROCRYPT ’89, Workshop on the Theory and Application of of Cryptographic Techniques, Houthalen, Belgium, April 10-13, 1989, Proceedings, pp. 571–585 (1989)
Wang, M.: Linear complexity profiles and jump complexity. Information Processing Letters 61(3), 165–168 (1997)
Wang, M., Massey, J.L.: The characterization of all binary sequences with perfect linear complexity profiles. In: EUROCRYPT, pp. 35–36 (1986)
Winterhof, A.: Linear complexity and related complexity measures. In: Selected Topics in Information and Coding Theory, pp. 3–40. World Scientific, Singapore (2010)
Acknowledgements
The authors would like to express their sincere thanks to the anonymous reviewers for providing valuable suggestions. They are partially supported by Tianjin Key Research and Development Project 19YFZCSF00900 and 20JCZDJC00610.
Author information
Authors and Affiliations
Additional information
Part of this work has been accepted and presented at SETA2020.
Appendix
Appendix
In order to calculate the expectation and variance of \(O_n\), we need to know its counting functions. Denote by \(N_n(\sigma )\) the number of n-bit binary sequences with the odd hop sum \(\sigma\), and \(NL_n(L,\sigma )\) by the number of n-bit binary sequences with the linear complexity L and the odd hop sum \(\sigma\).
From Proposition 1 or from the continued fraction method in [16], the number of n-bit binary sequences with a prescribed jump height sequence \(jh_1, jh_2, \dots , jh_m\), and the linear complexity L is
where \(L=jh_1+jh_2+\cdots +jh_m\).
Let the last m-th jump be in position k of such an n-bit sequence, we have \(jh_m=2L-k\ge 2L-n\), and obtain
By (9), for calculating \(NL_n(L,\sigma )\) we should count the number of sequences \(\{jh_1, jh_2, \ldots , jh_m\}\) with \(jh_1+jh_2+\cdots +jh_m=L\), \(jh_1+jh3+\cdots =\sigma\), and \(jh_m \ge \max \{1, 2L-n\}\). Next, we provide related lemmas.
Lemma 1
The number of positive integer sequences \(S=\{s_1,s_2,\dots ,s_m\}\) satisfying \(\sum _{i=1}^m s_i=h\) is
Lemma 2
The number of positive integer sequences \(S=\{s_1,\dots ,s_{last}\}\) satisfying \(\sum _{i\ge 1} s_i=h\) and \(\sum _{j \ge 0} s_{2j+1}=\bar{h}\) is
Proof
Let \(\mathcal {A}\) be the set of all positive integer sequences \(S_a=\{s_1,\dots ,s_{last}\}\) satisfying \(\sum _{i\ge 1} s_i=h\) and \(\sum _{j \ge 0} s_{2j+1}=\bar{h}\), and \(\mathcal {B}\) be the set of all positive integer sequences \(S_b=\{s_1,s_2,\dots ,s_{\bar{h}}\}\) satisfying \(\sum _{i=1}^{\bar{h}} s_i=h\).
Define \(f: \mathcal {A} \rightarrow \mathcal {B}\) as follows. For any sequence \(S_a=\{s_1,\dots ,s_{last}\}\) in \(\mathcal {A}\),
Once \(s_{2i-1}-1=0\), the corresponding terms will disappear. Regarding \(f(S_a)\), its sum is still h and its length becomes \(s_1-1+1+s_3-1+1+\cdots =\bar{h}\), so f is a mapping from \(\mathcal {A}\) to \(\mathcal {B}\).
Define \(g: \mathcal {B} \rightarrow \mathcal {A}\): for any sequence \(S_b\in \mathcal {B}\), if its last term is larger than 1, we may write it in the following unique format
where \(s_1,s_2,\dots ,s_{2k}\) are all positive integers. Then, we have \(g(S_b)=\{s_1,s_2,\dots ,s_{2k}\}\). If its last term is 1, we write it as
Then, we have \(g(S_b)=\{s_1,s_2,\dots ,s_{2k-1}\}\). In both cases the length of \(S_b\) is \(s_1+s_3+\ldots +s_{2k-1}\), which equals \(\bar{h}\), the sum of those terms with odd subscripts of \(g(S_b)\).
Therefore, we have \(|\mathcal {A}|=|\mathcal {B}|\), and derive the conclusion from Lemma 1.
Lemma 3
The number of positive integer sequences \(S=\{ s_1, \ldots , s_{last}\}\) satisfying \(\sum _{i\ge 1} s_i =h\), \(\sum _{j \ge 0} s_{2j+1}=\bar{h}\) and \(s_{last}\ge t\) (\(t\in Z,0<t<h\)) is
where
Proof
Let \(\mathcal {R}\) be the set of all positive integer sequences \(S=\{ s_1, \ldots , s_{last}\}\) satisfying \(\sum _{i\ge 1} s_i =h\), \(\sum _{j \ge 0} s_{2j+1}=\bar{h}\) and \(s_{last}\ge t\). And let
\(\mathcal {C}: =\{S_c|S_c\in \mathcal {R}, \mathrm {the length of}\, S\, \mathrm {is odd}\}\), and \(\mathcal {D}: =\{S_d|S_d\in \mathcal {R}, \mathrm {the length of}\,\, S\,\ \mathrm {is even}\}\).
Then, \(\mathcal {C}\cap \mathcal {D}=\emptyset\) and \(\mathcal {C}\cup \mathcal {D}=\mathcal {R}\), so we have
Let \(\mathcal {C}^{\prime }\) be the set of all positive integer sequences \(S=\{ s_1, \ldots , s_{last}\}\) satisfying \(\sum _{i\ge 1} s_i =h-t\), \(\sum _{j \ge 0} s_{2j+1}=\bar{h} - t\). Then, we define a mapping \(f_o: \mathcal {C}\rightarrow \mathcal {C}^{\prime }\): for any sequence \(S_c=\{ s_1, \ldots , s_{last}\}\in \mathcal {C}\),
In both cases \(f_o(S)\) is still a positive integer sequence since \(t<h\). And \(S_c\in \mathcal {C}\), \(s_{last}\) has an odd subscript, so the sum of all terms of \(f_o(S_c)\) is \(h-t\), and the sum of terms with odd subscripts of \(f_o(S_c)\) is \(\bar{h}-t\). Thus, \(f_o(S_c)\in \mathcal {C}^{\prime }\).
Conversely, we define the mapping \(g_o: \mathcal {C}^{\prime } \rightarrow \mathcal {C}\): for any sequence \(S_{c^{\prime }}=\{ s_1, \ldots , s_{last}\}\) in \(\mathcal {C}^{\prime }\),
In both cases the length of \(g_o(S_{c^{\prime }})\) is odd, the sum of all terms of \(g_o(S_{c^{\prime }})\) is t larger than that of \(S_{c^{\prime }}\), and the sum of terms with odd subscripts of \(g_o(S_{c^{\prime }})\) is also t larger than that of \(S_{c^{\prime }}\), thus \(g_o(S_{c^{\prime }})\in \mathcal {C}\).
Because \(f_o=g_o^{-1}\), they both are one-to-one mappings. Thus, we obtain \(|\mathcal {C}|=|\mathcal {C}^{\prime }|\). And by Lemma 2 we have
Let \(\mathcal {D}^{\prime}\) be the set of all positive integer sequences \(S=\{ s_1, \ldots , s_{last}\}\) satisfying \(\sum _{i\ge 1} s_i =h-t\), \(\sum _{j \ge 0} s_{2j+1}=\bar{h}\). Similarly, we define a pair of inverse mappings \(f_e:\mathcal {D}\rightarrow \mathcal {D}^{\prime}\) and \(g_e:\mathcal {D}^{\prime}\rightarrow \mathcal {D}\). For any sequence \(S_d=\{ s_1, s_2, \ldots , s_{last}\}\in \mathcal {D}\),
And for any sequence \(S_{d'}=\{ s_1,s_2, \ldots , s_{last}\} \in \mathcal {D}'\),
We obtain \(|\mathcal {D}|=|\mathcal {D}'|\) analogously. And from Lemma 2 we derive
Combining (12), (13) and (14), we have the conclusion.
For \(NL_n(L,\sigma )\), it is straightforward that \(L\in [0,n]\) and \(o\in [1,L]\). By Lemma 2 and (9), if \(0<L\le n/2\) and \(1\le \sigma \le L\), we have
If \(n/2<L<n\) and \(1\le \sigma \le L\), considering the restriction on the last jump height (10), and from (9) and Lemma 3 we obtain
Special cases include \(NL_n(0,0)=1\) and \(NL_n(n,n)=1\). Therefore, we conclude in the following lemma.
Lemma 4
The number of n-bit binary sequences with the linear linear complexity L and the odd hop sum o is
Because \(L \ge \sigma\), we get \(N_n(\sigma )=\sum _{L=0}^nNL_n(L,\sigma )=\sum _{L=\sigma }^nNL_n(L,\sigma ).\) Before deriving the explicit formulae of \(E(O_n)\) and \(V(O_n)\), we need the following identities.
where the combinatorial numbers \(\mathrm {C}_i^1=i\) and \(\mathrm {C}_i^2=\frac{i(i-1)}{2}\). Also, we let \(\mathrm {C}_i^j:=0\) if \(j>i\). Proof of Theorem 1
Proof
It is straightforward that
Because of (15), we divide \(\sum _{L=0}^n \sum _{\sigma =0}^L \sigma \cdot NL_n(L,\sigma )\) into different parts:
The last identity is due to \(NL_n(n,\sigma ) \ne 0\) only when \(\sigma =n\). Then, we compute the two sums in the right side of (23).
Initially, we set \(n>2\). Now let n be even. By (17), (18), (19) and (20) we obtain
And by (15) we have
Because of (11) we have
and
Combining (25), (26) and (27), we get
By (16), (17), (19) and (20), we have
Therefore, combing (22), (23), (24) and (28), if n is even, we have
If n is odd, since \(\lfloor n/2\rfloor =(n-1)/2\), similarly we have \(E(O_n) =\frac{n}{4}+\frac{23}{36}+\frac{3n-10}{9\cdot 2^n}\).
Now we compute \(V(O_n)\). Because \(V(O_n)=E(O_n^2)-E^2(O_n)\), we calculate \(E(O_n^2)\) first.
Because of (15) we have
Next we calculate the two sums in the right side of (31).
First, let n be even. Then we have
where the last identity is due to (16), (17) and (18). Combining (20) and (21), we have
And from (15) we derive
We have
and if \(n\le 2 L\) we have
Combining (33), (34) and (35), we get
Combing (30), (31), (32) and (36), we have
then if n is even, from (29) we derive
If n is odd, similarly we obtain \(V(O_n) =\frac{n}{8}+\frac{367}{648}+\frac{27n^2-195n+74}{162\cdot 2^n}-\frac{(3n-10)^2}{81\cdot 4^n}\).
Also, we can verify that the conclusion is still correct for \(n=1,2\).
Rights and permissions
About this article
Cite this article
Li, H., Liu, Y., Su, M. et al. Jump and hop randomness tests for binary sequences. Cryptogr. Commun. 14, 483–502 (2022). https://doi.org/10.1007/s12095-021-00538-3
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s12095-021-00538-3