# An Efficient Algorithm to Compute the Linear Complexity of Binary Sequences

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Basic Concepts and Generalities

#### 2.1. Linear Feedback Shift Registers

#### 2.2. The Generalized Self-Shrinking Generator

#### 2.3. Binomial Sequences

**Definition**

**1.**

**Proposition**

**1**

- (a)
- The period of such a sequence is $T={2}^{L+1}$;
- (b)
- The period of such a sequence has the following structure:$${\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{L}+k}\right\}}_{}0\le n{2}^{L+1}$$

**Corollary**

**1**

**Corollary**

**2**

**Remark**

**1.**

**Example**

**1.**

**Theorem**

**1.**

#### 2.4. Construction of Binomial Matrices from Binomial Sequences

**Definition**

**2.**

- Its rows correspond to the first ${2}^{t}$ bits of the first ${2}^{t}$ binomial sequences, that is,$${H}_{t}=\left(\right)open="["\; close="]">\begin{array}{c}\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{0}\right\}\end{array}\\ \left\{\left(\right),\genfrac{}{}{0pt}{}{n}{1}\right\}\\ \left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{t}-1}\right\}$$
- Its columns correspond to the first ${2}^{t}$ bits of shifted versions of the first ${2}^{t}$ binomial sequences starting in their first one, i.e., the columns of ${H}_{t}$ are the diagonals of Sierpinski’s triangle (see Figure 2):$${H}_{t}=\left[\begin{array}{c}{\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{t}-1}\right\}}^{}*\\ {\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{t}-1}\right\}}^{}*\end{array},\dots & ,{\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{1}\right\}}^{}*\right]{\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{0}\right\}}^{}*$$

## 3. B-Representation

- Period of $\left\{{s}_{n}\right\}$ in terms of the B-representation: As a consequence of Proposition 1, it is possible to prove that the period T of the sequence $\left\{{s}_{n}\right\}$ is the period of the binomial sequence $\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{imax}\right\}$, since the period of the sequence is the greatest period of the binomial sequences included in its B-representation (see ([26], Proposition 3));
- Linear complexity of $\left\{{s}_{n}\right\}$ in terms of the B-representation: As a consequence of Theorem 1, the linear complexity of the sequence $\left\{{s}_{n}\right\}$ is the linear complexity of the binomial sequence $\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{imax}\right\}$ (see ([26], Corollary 14)), that is:$$LC=imax+1.$$

**Theorem**

**2.**

**Proof.**

**Lemma**

**1.**

**Proof.**

**Theorem**

**3.**

**Proof.**

**Example**

**2.**

## 4. Computation of $\mathit{LC}$ by Means of the B-Representation

#### 4.1. An Algorithm to Compute the $LC$ of Sequences with a Period of a Power of Two

Algorithm 1: Computation of the $LC$ of a given sequence. |

Input: |

$seq$: sequence of period ${2}^{t}$, |

${H}_{t}$: the $({2}^{t}\times {2}^{t})$ binomial matrix |

01: $imax=-1$; $i=length\left(seq\right)-1$; |

02: while $i\ge 0$ do |

03: ${c}_{i}=({s}_{0},{s}_{1},\dots ,{s}_{{2}^{t}-1})\xb7{\mathit{h}}_{\mathit{i}}$; |

04: if ${c}_{i}\ne 0$ then |

05: $imax=i$; |

06: Break; |

07: endif |

08: $i=i-1$; |

09: endwhile |

Output: |

$LC=imax+1$: Linear complexity of the sequence. |

- The algorithm that computes $LC$ is reduced to products modulo two of binary vectors. Clearly, its computational complexity will be minimum compared with other algorithms found in the literature; see Section 6;
- If the column ${\mathit{h}}_{\mathit{imax}}$ has many zeros and only a few ones, then only a few terms of the sequence $\left\{{s}_{n}\right\}$ will be required to compute its $LC$.

#### 4.2. Sequences with an Upper Bound on the Linear Complexity

- If ${c}_{imax}\ne 0$, then the linear complexity of the sequence is $L{C}_{max}$. Recall that, in this case, the computation of $LC$ was reduced to the simple product of two binary vectors. For sequences with an upper bound on $LC$, this computation can be seen as a quick test to check whether the sequence exhibits maximum $LC$;
- If ${c}_{imax}=0$, then the previous algorithm proceeds in decreasing order computing the remaining indices $(imax>i\ge 0)$ until a coefficient ${c}_{i}\ne 0$ is reached. In that case, the linear complexity of the sequence satisfies $LC<L{C}_{max}$.

## 5. Application of the Algorithm to Generalized Sequences

**Example**

**3.**

#### 5.1. Analysis of 3 $\le L\le $ 5

#### 5.2. Analysis of 5 $\le L\le $ 17

- Step 1: Take the $\left(\right)$-matrix ${H}_{4}$ in Equation (10) as the reference matrix, the 16-box, since the successive matrices ${H}_{L-1}$ are made up of sub-matrices ${H}_{4}$ or 16-boxes;
- Step 2: Divide the period $T={2}^{L-1}$ of the generalized sequence by 16 to determine the number of 16-boxes included in the $({2}^{L-1}\times {2}^{L-1})$-matrix ${H}_{L-1}$;
- Step 3: Count the number of ones in the column ${\mathit{h}}_{\mathit{imax}}$ of the 16-box;
- Step 4: Multiply this number by the number of 16-boxes in ${H}_{L-1}$ in order to obtain the total number of ones in the column ${\mathit{h}}_{\mathit{imax}}$ of ${H}_{L-1}$. This number coincides with the number of bits necessary to check whether the generalized sequence has $L{C}_{max}$. At the same time, the column ${\mathit{h}}_{\mathit{imax}}$ shows the distribution of the required bits all along the sequence $\left\{{s}_{n}\right\}$.

- L = length of the LFSR generating the family of generalized sequences;
- $T={2}^{L-1}$ period of the generalized sequence;
- No. of 16-boxes: number of 16-boxes included in the binomial matrix ${H}_{L-1}$, i.e., $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$16$}\right.$;
- No. of ones/16-box: number of ones in the column ${\mathit{h}}_{\mathit{imax}}$ of the 16-box;
- No. of required bits: number of one in the column ${\mathit{h}}_{\mathit{imax}}$ of the matrix ${H}_{L-1}$ or, equivalently, number of required bits of the sequence $\left\{{s}_{n}\right\}$; this number is expressed as a fraction of the period T.

**Theorem**

**4.**

**Proof.**

**Theorem**

**5.**

**Proof.**

- For $L=10$, ${\mathit{h}}_{\mathit{imax}}={\left(1111111100000000\right)}^{\prime}$, which means that eight out of sixteen bits of the sequence are needed to check whether $LC=L{C}_{max}$. Moreover, the required bits must be consecutive;
- For $L=17$, ${\mathit{h}}_{\mathit{imax}}={\left(1000000000000000\right)}^{\prime}$, which means that one out of sixteen bits of the sequence is needed to check whether the linear complexity is maximum;
- For the remaining values of L, the number of required bits takes the values $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$4$}\right.$ or $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$8$}\right.$, as shown in Table 5. In fact, it depends on the number of ones along the column ${\mathit{h}}_{\mathit{imax}}$ of the 16-box, in particular, $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$8$}\right.$ for columns with two ones, e.g., $L=9,13,15,16$, and $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$4$}\right.$ for columns with four ones, e.g., $L=5,7,8,11,12,14$.

#### 5.3. Analysis of 18 $\le L\le $ 33

#### 5.4. Analysis of 34 $\le L\le $ 65

- For $L\in [34,35,\cdots ,49]$, in the the 64-box columns we will have the ones of two 16-boxes plus thirty-two consecutive zeros of ${0}_{5}$;
- For $L\in [50,51,\cdots ,65]$, in the 64-box columns, we will have the ones of the 16-box plus $16+32$ consecutive zeros coming from ${0}_{4}$ and ${0}_{5}$, respectively. See Table 8.

#### 5.5. Analysis of 66$\le L\le $ 129

- For $L\in [66,67,\cdots ,81]$, in the the 128-box columns, we will have the ones of four 16-boxes plus sixty-four consecutive zeros of ${0}_{6}$;
- For $L\in [82,83,\cdots ,97]$, in the 128-box columns, we will have the ones of the 16-box, then sixteen consecutive zeros coming from ${0}_{4}$, then the ones of the 16-box, and finally, sixteen consecutive zeros coming from ${0}_{4}$. See Table A1;
- For $L\in [98,99,\cdots ,113]$, in the 128-box columns, we will have the ones of two consecutive 16-boxes, then $32+64$ consecutive zeros coming from ${0}_{5}$ and ${0}_{6}$, respectively;
- For $L\in [114,115,\cdots ,129]$, in the the 128-box columns, we will have the ones of a unique 16-box, then $16+32+64$ consecutive zeros coming from ${0}_{4}$, ${0}_{5}$, and ${0}_{6}$, respectively. See Table A1.

- In the interval $L\in [66,67,\cdots ,81]$, the least suitable case is $L=66$, corresponding to the binomial sequence ${\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{64}\right\}}^{}$ where $16+16+16+16$ consecutive bits of the sequence are required followed by other 64 non-necessary bits, that is $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$2$}\right.$ bits of the sequence are needed to check the maximum complexity;
- In the interval $L\in [82,83,\cdots ,97]$, the most suitable case is $L=97$ where the distribution of the needed bits over the sequence is as follows: two bits separated thirty positions from each other followed by $15+16+64$ redundant bits, which means that we need the knowledge of $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$64$}\right.$ bits of the sequence;
- In the interval $L\in [98,99,\cdots ,113]$, the most suitable case is $L=113$, where the distribution of the needed bits over the sequence is as follows: two bits separated sixteen positions from each other followed by $15+32+64$ redundant bits, which means that we need the knowledge of $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$64$}\right.$ bits of the sequence;
- In the interval $L\in [114,115,\cdots ,129]$, the most suitable case is $L=129$, corresponding to the binomial sequence ${\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{127}\right\}}^{}$. In that case, one out of one-hundred twenty-eight bits is required to check $L{C}_{max}$.

- The 16-box for $L\in [5,6,\cdots ,17]$;
- The 32-box for $L\in [18,19,\cdots ,33]$;
- The 64-box for $L\in [34,35,\cdots ,65]$;
- The 128-box for $L\in [66,67,\cdots ,129]$.

**Remark**

**2.**

## 6. Comparison with Other Algorithms

- The Berlekamp–Massey algorithm [28] computes the $LC$ of a sequence synthesizing the shortest LFSR that generates such a sequence. It is a sequential algorithm that needs to know and process at least $2\xb7LC$ consecutive bits of the sequence. In the case of application to, e.g., generalized sequences, this means the knowledge of more than one period of the sequence, which is clearly out of the application range. The characteristics of this algorithm are depicted in the first row of Table 11;
- In [26], the authors proposed an algorithm, Binomial Sequence Decomposition (BSD-algorithm), that computes the B-representation of a sequence and, consequently, its $LC$ via Equation (5). Thus, the BSD-algorithm computes the linear complexity, as the Berlekamp–Massey algorithm does, but after having processed only $LC$ bits instead of $2\xb7LC$. The complexity of the BSD-algorithm, which performs the sum of two sequences of T bits (T additions) for every binomial sequence, is $O(r\times T)$, r being the number of binomial sequences with $\phantom{\rule{4pt}{0ex}}r\ll T$. Again, this method is, in practice, unrealistic. See the characteristics of this algorithm in the second row of Table 11;
- The folding algorithm [30] is another technique to compute the $LC$ of sequences with a period of a power of two, $T={2}^{t}$. It is based on successive foldings of the own sequence to locate the maximum binomial sequence and calculate $LC$. At every step, the folding algorithm sums the first half of the sequence with the second half to cancel common binomial sequences in both halves. The procedure ends when only one bit is left. In fact, at every step, the folding mechanism reduces the length of the studied sequence by two with a total of $logT$ steps. Moreover, at each step, the folding algorithm performs $T/{2}^{i}$$(i=0,\dots ,logT)$ logic operations. This algorithm only performs logic operations, but it needs to handle the whole sequence. See the characteristics of such an algorithm in the third row of Table 11;
- In the method proposed in this work, two main features must be enhanced:
- (a)
- The algorithm only performs bitwise XOR logic operations;
- (b)
- It will never need the whole sequence, as the Hadamard matrices always include null blocks corresponding to portions of the sequence whose knowledge is not necessary.

When this algorithm is applied, there are more and less favorable cases. For an integer fixed m, the worst scenario corresponds to sequences whose column ${\mathit{h}}_{\mathit{imax}}$ in the binomial matrix is the binomial sequence ${\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{m}}\right\}}^{}$, as we need the knowledge of half the sequence $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{$2$}\right.$. Conversely, the most favorable scenario corresponds to sequences whose column ${\mathit{h}}_{\mathit{imax}}$ in the binomial matrix is the binomial sequence ${\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{m+1}-1}\right\}}^{}$, as we need the knowledge of $\raisebox{1ex}{$T$}\!\left/ \!\raisebox{-1ex}{${2}^{m}$}\right.$ bits of the sequence. See the characteristics of this algorithm in the fourth row of Table 11.

## 7. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

LFSR | Linear Feedback Shift Register |

PRNG | Pseudo-Random Number Generator |

GSSG | Generalized Self-Shrinking Generator |

$LC$ | Linear Complexity |

IoT | Internet of Things |

## Appendix A

${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | |||||||||||||||||

${0}_{4}$ | ${H}_{4}$ | ${0}_{4}$ | ${H}_{4}$ | ${0}_{4}$ | ${H}_{4}$ | ${0}_{4}$ | ${H}_{4}$ | |||||||||||||||||

${0}_{5}$ | ${H}_{4}$ | ${H}_{4}$ | ${0}_{5}$ | ${H}_{4}$ | ${H}_{4}$ | |||||||||||||||||||

${0}_{4}$ | ${H}_{4}$ | ${0}_{4}$ | ${H}_{4}$ | |||||||||||||||||||||

${0}_{6}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ||||||||||||||||||||

${0}_{4}$ | ${H}_{4}$ | ${0}_{4}$ | ${H}_{4}$ | |||||||||||||||||||||

${0}_{5}$ | ${H}_{4}$ | ${H}_{4}$ | ||||||||||||||||||||||

${0}_{4}$ | ${H}_{4}$ | |||||||||||||||||||||||

$L=$ | 129 | … | 114 | 113 | … | 98 | 97 | … | 82 | 81 | … | 66 | 65 | … | 34 | 33 | … | 18 | 17 | … | 2 |

## References

- Bouguettaya, A.; Sheng, Q.Z.; Benatallah, B.; Neiat, A.G.; Mistry, S.; Ghose, A.; Nepal, S.; Yao, L. An internet of things service roadmap. Commun. ACM
**2021**, 64, 86–95. [Google Scholar] [CrossRef] - Zhang, W.; Sheng, Q.Z.; Mahmood, A.; Tran, D.; Zaib, M.; Hamad, S.; Aljubairy, A.; Alhazmi, A.F.; Sagar, S.; Ma, C. The 10 Research Topics in the Internet of Things. In Proceedings of the 2020 IEEE 6th International Conference on Collaboration and Internet Computing (CIC), Atlanta, GA, USA, 1–3 December 2020; IEEE Computer Society: Los Alamitos, CA, USA, 2020; pp. 34–43. [Google Scholar] [CrossRef]
- Khan, W.Z.; Arshad, Q.u.A.; Hakak, S.; Khan, M.K.; Saeed-Ur-Rehman. Trust Management in Social Internet of Things: Architectures, Recent Advancements, and Future Challenges. IEEE Internet Things J.
**2021**, 8, 7768–7788. [Google Scholar] [CrossRef] - Xu, L.D.; Lu, Y.; Li, L. Embedding Blockchain Technology Into IoT for Security: A Survey. IEEE Internet Things J.
**2021**, 8, 10452–10473. [Google Scholar] [CrossRef] - Mahmood, A.; Siddiqui, S.A.; Sheng, Q.Z.; Zhang, W.E.; Suzuki, H.; Ni, W. Trust on wheels: Towards secure and resource efficient IoV networks. Computing
**2022**. [Google Scholar] [CrossRef] - Fischer, V. A Closer Look at Security in Random Number Generators Design. In Constructive Side-Channel Analysis and Secure Design, COSADE 2012; Schindler, W., Huss, S.A., Eds.; Springer: Berlin/Heidelberg, Germany, 2012; Volume 7275, pp. 167–182. [Google Scholar] [CrossRef] [Green Version]
- Francillon, A.; Castelluccia, C. TinyRNG: A Cryptographic Random Number Generator for Wireless Sensors Network Nodes. In Proceedings of the 2007 5th International Symposium on Modeling and Optimization in Mobile, Ad Hoc and Wireless Networks and Workshops, Limassol, Cyprus, 16–20 April 2007; pp. 1–7. [Google Scholar] [CrossRef] [Green Version]
- Biryukov, A.; Shamir, A.; Wagner, D. Real Time Cryptanalysis of A5/1 on a PC. In Proceedings of the Fast Software Encryption 2000, New York, NY, USA, 10–12 April 2000; Goos, G., Hartmanis, J., Van Leeuwen, J., Schneier, B., Eds.; Springer: Berlin/Heidelberg, Germany, 2001; Volume 1978, pp. 1–18. [Google Scholar] [CrossRef] [Green Version]
- Petrovic, S.; Fúster-Sabater, A. Cryptanalysis of the A5/2 Algorithm. IACR Cryptol. EPrint Arch.
**2000**, 2000, 52. [Google Scholar] - Peinado, A.; Munilla, J.; Fúster-Sabater, A. EPCGen2 Pseudorandom Number Generators: Analysis of J3Gen. Sensors
**2014**, 14, 6500–6515. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Paul, G.; Maitra, S. RC4 Stream Cipher and Its Variants; CRC Press, Taylor and Francis Group: Boca Raton, FL, USA, 2012. [Google Scholar]
- Dutta, I.K.; Ghosh, B.; Bayoumi, M. Lightweight Cryptography for Internet of Insecure Things: A Survey. In Proceedings of the 2019 IEEE 9th Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, NV, USA, 7–9 January 2019; pp. 475–481. [Google Scholar] [CrossRef]
- Philip, M.A.; Vaithiyanathan. A survey on lightweight ciphers for IoT devices. In Proceedings of the 2017 International Conference on Technological Advancements in Power and Energy ( TAP Energy), Kollam, India, 21–23 December 2017; pp. 1–4. [CrossRef]
- Dubrova, E.; Hell, M. Espresso: A stream cipher for 5G wireless communication systems. Cryptogr. Commun.
**2017**, 9, 273–289. [Google Scholar] [CrossRef] [Green Version] - Orúe López, A.B.; Hernández Encinas, L.; Montoya Vitini, F. Trifork, a new Pseudorandom Number Generator Based on Lagged Fibonacci Maps. J. Comput. Sci. Eng.
**2010**, 2, 46–51. [Google Scholar] - Paar, C.; Pelzl, J. Understanding Cryptography; Springer: Berlin, Germany, 2010. [Google Scholar]
- Golomb, S.W. Shift Register-Sequences; Aegean Park Press: Laguna Hill, CA, USA, 1982. [Google Scholar]
- Biryukov, A.; Perrin, L. State of the Art in Lightweight Symmetric Cryptography. IACR Cryptol. EPrint Arch.
**2017**, 2017, 511. [Google Scholar] - Orúe López, A.B.; Hernández Encinas, L.; Martín Muñoz, A.; Montoya Vitini, F. A Lightweight Pseudorandom Number Generator for Securing the Internet of Things. IEEE Access
**2017**, 5, 27800–27806. [Google Scholar] [CrossRef] - Shabbir Hassan, M.U.B. Design of Pseudo Random Number Generator using Linear Feedback Shift Register. Int. J. Eng. Adv. Technol. IJEAT
**2019**, 9, 1956–1965. [Google Scholar] [CrossRef] - Rahimov, H.; Babaei, M.; Farhadi, M. Cryptographic PRNG based on combination of LFSR and chaotic logistic map. Appl. Math.
**2011**, 2, 1531–1534. [Google Scholar] [CrossRef] [Green Version] - Díaz Cardell, S.; Fúster-Sabater, A. Cryptography with Shrinking Generators: Fundamentals and Applications of Keystream Sequence Generators Based on Irregular Decimation; Springer Briefs in Mathematics; Springer International Publishing: Berlin/Heidelberg, Germany, 2019. [Google Scholar] [CrossRef]
- Hu, Y.; Xiao, G. Generalized Self-Shrinking Generator. IEEE Trans Inf. Theory
**2004**, 50, 714–719. [Google Scholar] [CrossRef] - Cardell, S.D.; Requena, V.; Fúster-Sabater, A.; Orúe, A.B. Randomness Analysis for the Generalized Self-Shrinking Sequences. Symmetry
**2019**, 11, 1460. [Google Scholar] [CrossRef] [Green Version] - Seberry, J.; Yamada, M. Hadamard matrices, Sequences, and Block Designs. In Contemporary Design Theory—A Collection of Surveys; Stinson, D.J., Dinitz, J., Eds.; John Wiley and Sons: Chichester, UK, 1992; pp. 431–560. [Google Scholar]
- Cardell, S.D.; Fúster-Sabater, A. Binomial Representation of Cryptographic Binary Sequences and Its Relation to Cellular Automata. Complexity
**2019**, 2019, 2108014. [Google Scholar] [CrossRef] [Green Version] - Cardell, S.D.; Climent, J.J.; Fúster-Sabater, A.; Requena, V. Representations of Generalized Self-Shrunken Sequences. Mathematics
**2020**, 8, 1006. [Google Scholar] [CrossRef] - Massey, J.L. Shift-register synthesis and BCH decoding. IEEE Trans. Inf. Theory
**1969**, 15, 122–127. [Google Scholar] [CrossRef] [Green Version] - Fúster-Sabater, A.; Cardell, S. Linear complexity of generalized sequences by comparison of PN-sequences. Rev. Real Acad. Cienc. Exactas Físicas Y Nat. Ser. A Mat. RACSAM
**2020**, 114, 79–97. [Google Scholar] [CrossRef] - Martin-Navarro, J.L.; Fúster-Sabater, A. Folding-BSD Algorithm for Binary Sequence Decomposition. Computers
**2020**, 9, 100. [Google Scholar] [CrossRef] - Rueppel, R.A. Linear Complexity and Random Sequences. In Advances in Cryptology — EUROCRYPT 85, Workshop on the Theory and Application of of Cryptographic Techniques; Lecture Notes in Computer Science; Pichler, F., Ed.; Springer: Berlin/Heidelberg, Germany, 1986; Volume 219, pp. 167–188. [Google Scholar] [CrossRef]
- Cardell, S.D.; Fúster-Sabater, A. Discrete linear models for the generalized self-shrunken sequences. Finite Fields Their Appl.
**2017**, 47, 222–241. [Google Scholar] [CrossRef]

**Figure 3.**Structure of the binomial sequences $\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{k}\right\}$ and $\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{{2}^{L}+k}\right\}$.

**Figure 4.**Binary Sierpinski’s triangle where the circled bits correspond to the shifted version of the binomial sequence $\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{4}\right\}$.

**Table 1.**The first 8 binomial coefficients $\left(\right)$$(0\le k<8)$ and their binomial sequences $\left\{\left(\right),\genfrac{}{}{0pt}{}{n}{k}\right\}$, periods, and linear complexities.

Binomial Coeff. | Binomial Sequences $\left\{\left(\right),\genfrac{}{}{0pt}{}{\mathit{n}}{\mathit{k}}\right\}$ | Period | LC |
---|---|---|---|

$\left(\right)$ | $11111111\dots $ | 1 | 1 |

$\left(\right)$ | $01010101\dots $ | 2 | 2 |

$\left(\right)$ | $00110011\dots $ | 4 | 3 |

$\left(\right)$ | $00010001\dots $ | 4 | 4 |

$\left(\right)$ | $00001111\dots $ | 8 | 5 |

$\left(\right)$ | $00000101\dots $ | 8 | 6 |

$\left(\right)$ | $00000011\dots $ | 8 | 7 |

$\left(\right)$ | $00000001\dots $ | 8 | 8 |

**Table 2.**Table of the values of the upper bound of $LC$, $imax$, and ${\mathit{h}}_{\mathit{imax}}$ for $L=3,4,5$.

L | ${\mathit{LC}}_{\mathit{max}}$ | $\mathit{imax}$ | ${\mathit{h}}_{\mathit{imax}}$ | ${\mathit{H}}_{\mathit{L}-1}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{\mathit{n}}{\mathit{k}}}^{\}}*$ |
---|---|---|---|---|---|

3 | 3 | 2 | 2 | ${H}_{2}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{1}}^{\}}$ |

4 | 6 | 5 | 3 | ${H}_{3}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{2}}^{\}}$ |

5 | 13 | 12 | 4 | ${H}_{4}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{3}}^{\}}$ |

1 | 1 | 1 | 1 | |

0 | 1 | 0 | 1 | |

0 | 0 | 1 | 1 | |

0 | 0 | 0 | 1 | |

L = | 5 | 4 | 3 | |

${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{k}}^{\}}$ = | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{3}}^{\}}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{2}}^{\}}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{1}}^{\}}$ |

1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |

0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | |

0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | |

0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | |

0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | |

0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |

0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | |

L = | 17 | … | 10 | 9 | … | 5 | ||||||||||

${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{k}}^{\}}$ = | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{15}}^{\}}$ | … | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{8}}^{\}}$ | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{7}}^{\}}$ | … | ${\{\left(\right)open="("\; close=")">\genfrac{}{}{0pt}{}{n}{3}}^{\}}$ |

L | T | No. of 16-Boxes | No. of 1’s/16-Box | No. of Required Bits |
---|---|---|---|---|

5 | ${2}^{4}$ | ${2}^{0}$ | ${2}^{2}$ | ${2}^{2}=T/4$ |

6 | ${2}^{5}$ | ${2}^{1}$ | ${2}^{3}$ | ${2}^{4}=T/2$ |

7 | ${2}^{6}$ | ${2}^{2}$ | ${2}^{2}$ | ${2}^{4}=T/4$ |

8 | ${2}^{7}$ | ${2}^{3}$ | ${2}^{2}$ | ${2}^{5}=T/4$ |

9 | ${2}^{8}$ | ${2}^{4}$ | ${2}^{1}$ | ${2}^{5}=T/8$ |

10 | ${2}^{9}$ | ${2}^{5}$ | ${2}^{3}$ | ${2}^{8}=T/2$ |

11 | ${2}^{10}$ | ${2}^{6}$ | ${2}^{2}$ | ${2}^{8}=T/4$ |

12 | ${2}^{11}$ | ${2}^{7}$ | ${2}^{2}$ | ${2}^{9}=T/4$ |

13 | ${2}^{12}$ | ${2}^{8}$ | ${2}^{1}$ | ${2}^{9}=T/8$ |

14 | ${2}^{13}$ | ${2}^{9}$ | ${2}^{2}$ | ${2}^{11}=T/4$ |

15 | ${2}^{14}$ | ${2}^{10}$ | ${2}^{1}$ | ${2}^{11}=T/8$ |

16 | ${2}^{15}$ | ${2}^{11}$ | ${2}^{1}$ | ${2}^{12}=T/8$ |

17 | ${2}^{16}$ | ${2}^{12}$ | ${2}^{0}$ | ${2}^{12}=T/16$ |

${H}_{4}$ | ${H}_{4}$ | |||||||||||

${0}_{4}$ | ${H}_{4}$ | |||||||||||

$L=$ | 33 | … | 26 | 25 | … | 18 | 17 | … | 10 | 9 | … | 2 |

L | T | No. of 32-Boxes | No. of 1’s/32-Box | No. of Required Bits |
---|---|---|---|---|

18 | ${2}^{17}$ | ${2}^{12}$ | ${2}^{4}$ | ${2}^{16}=T/2$ |

19 | ${2}^{18}$ | ${2}^{13}$ | ${2}^{3}$ | ${2}^{16}=T/4$ |

20 | ${2}^{19}$ | ${2}^{14}$ | ${2}^{3}$ | ${2}^{17}=T/4$ |

21 | ${2}^{20}$ | ${2}^{15}$ | ${2}^{2}$ | ${2}^{17}=T/8$ |

22 | ${2}^{21}$ | ${2}^{16}$ | ${2}^{3}$ | ${2}^{19}=T/4$ |

23 | ${2}^{22}$ | ${2}^{17}$ | ${2}^{2}$ | ${2}^{19}=T/8$ |

24 | ${2}^{23}$ | ${2}^{18}$ | ${2}^{2}$ | ${2}^{20}=T/8$ |

25 | ${2}^{24}$ | ${2}^{19}$ | ${2}^{1}$ | ${2}^{20}=T/16$ |

26 | ${2}^{25}$ | ${2}^{20}$ | ${2}^{3}$ | ${2}^{23}=T/4$ |

27 | ${2}^{26}$ | ${2}^{21}$ | ${2}^{2}$ | ${2}^{23}=T/8$ |

28 | ${2}^{27}$ | ${2}^{22}$ | ${2}^{2}$ | ${2}^{24}=T/8$ |

29 | ${2}^{28}$ | ${2}^{23}$ | ${2}^{1}$ | ${2}^{24}=T/16$ |

30 | ${2}^{29}$ | ${2}^{24}$ | ${2}^{2}$ | ${2}^{26}=T/8$ |

31 | ${2}^{30}$ | ${2}^{25}$ | ${2}^{1}$ | ${2}^{26}=T/16$ |

32 | ${2}^{31}$ | ${2}^{26}$ | ${2}^{1}$ | ${2}^{27}=T/16$ |

33 | ${2}^{32}$ | ${2}^{27}$ | ${2}^{0}$ | ${2}^{27}=T/32$ |

${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | ${H}_{4}$ | |||||||||

${0}_{4}$ | ${H}_{4}$ | ${0}_{4}$ | ${H}_{4}$ | |||||||||

${0}_{5}$ | ${H}_{4}$ | ${H}_{4}$ | ||||||||||

${0}_{4}$ | ${H}_{4}$ | |||||||||||

L = | 65 | … | 50 | 49 | … | 34 | 33 | … | 18 | 17 | … | 2 |

L | T | No. of 64-Boxes | No. of 1’s/64-Box | No. of Required Bits |
---|---|---|---|---|

34 | ${2}^{33}$ | ${2}^{27}$ | ${2}^{5}$ | ${2}^{32}=T/2$ |

38 | ${2}^{37}$ | ${2}^{31}$ | ${2}^{4}$ | ${2}^{35}=T/4$ |

39 | ${2}^{38}$ | ${2}^{32}$ | ${2}^{3}$ | ${2}^{35}=T/8$ |

41 | ${2}^{40}$ | ${2}^{34}$ | ${2}^{2}$ | ${2}^{36}=T/16$ |

45 | ${2}^{44}$ | ${2}^{38}$ | ${2}^{2}$ | ${2}^{40}=T/16$ |

47 | ${2}^{46}$ | ${2}^{40}$ | ${2}^{2}$ | ${2}^{42}=T/16$ |

48 | ${2}^{47}$ | ${2}^{41}$ | ${2}^{2}$ | ${2}^{43}=T/16$ |

49 | ${2}^{48}$ | ${2}^{42}$ | ${2}^{0}$ | ${2}^{43}=T/32$ |

50 | ${2}^{49}$ | ${2}^{43}$ | ${2}^{4}$ | ${2}^{47}=T/4$ |

54 | ${2}^{53}$ | ${2}^{47}$ | ${2}^{3}$ | ${2}^{50}=T/8$ |

55 | ${2}^{54}$ | ${2}^{48}$ | ${2}^{2}$ | ${2}^{50}=T/16$ |

57 | ${2}^{56}$ | ${2}^{50}$ | ${2}^{1}$ | ${2}^{51}=T/32$ |

61 | ${2}^{60}$ | ${2}^{54}$ | ${2}^{1}$ | ${2}^{55}=T/32$ |

63 | ${2}^{62}$ | ${2}^{56}$ | ${2}^{1}$ | ${2}^{57}=T/32$ |

64 | ${2}^{63}$ | ${2}^{57}$ | ${2}^{1}$ | ${2}^{58}=T/32$ |

65 | ${2}^{64}$ | ${2}^{58}$ | ${2}^{0}$ | ${2}^{58}=T/64$ |

L | T | No. of 128-Boxes | No. of 1’s/128-Box | No. of Required Bits |
---|---|---|---|---|

66 | ${2}^{65}$ | ${2}^{58}$ | ${2}^{6}$ | ${2}^{64}=T/2$ |

67 | ${2}^{66}$ | ${2}^{59}$ | ${2}^{5}$ | ${2}^{64}=T/4$ |

69 | ${2}^{68}$ | ${2}^{61}$ | ${2}^{4}$ | ${2}^{65}=T/8$ |

73 | ${2}^{72}$ | ${2}^{65}$ | ${2}^{3}$ | ${2}^{68}=T/16$ |

78 | ${2}^{77}$ | ${2}^{70}$ | ${2}^{4}$ | ${2}^{74}=T/8$ |

79 | ${2}^{78}$ | ${2}^{71}$ | ${2}^{3}$ | ${2}^{74}=T/16$ |

80 | ${2}^{79}$ | ${2}^{72}$ | ${2}^{3}$ | ${2}^{75}=T/16$ |

81 | ${2}^{80}$ | ${2}^{73}$ | ${2}^{2}$ | ${2}^{75}=T/32$ |

82 | ${2}^{81}$ | ${2}^{74}$ | ${2}^{5}$ | ${2}^{79}=T/4$ |

83 | ${2}^{82}$ | ${2}^{75}$ | ${2}^{4}$ | ${2}^{79}=T/8$ |

85 | ${2}^{84}$ | ${2}^{77}$ | ${2}^{3}$ | ${2}^{80}=T/16$ |

89 | ${2}^{88}$ | ${2}^{81}$ | ${2}^{2}$ | ${2}^{83}=T/32$ |

94 | ${2}^{93}$ | ${2}^{86}$ | ${2}^{3}$ | ${2}^{89}=T/16$ |

95 | ${2}^{94}$ | ${2}^{87}$ | ${2}^{2}$ | ${2}^{89}=T/32$ |

96 | ${2}^{95}$ | ${2}^{88}$ | ${2}^{2}$ | ${2}^{90}=T/32$ |

97 | ${2}^{96}$ | ${2}^{89}$ | ${2}^{1}$ | ${2}^{90}=T/64$ |

98 | ${2}^{97}$ | ${2}^{90}$ | ${2}^{5}$ | ${2}^{95}=T/4$ |

99 | ${2}^{98}$ | ${2}^{91}$ | ${2}^{4}$ | ${2}^{95}=T/8$ |

101 | ${2}^{100}$ | ${2}^{93}$ | ${2}^{3}$ | ${2}^{96}=T/16$ |

105 | ${2}^{104}$ | ${2}^{97}$ | ${2}^{2}$ | ${2}^{99}=T/32$ |

110 | ${2}^{109}$ | ${2}^{102}$ | ${2}^{3}$ | ${2}^{105}=T/16$ |

111 | ${2}^{110}$ | ${2}^{103}$ | ${2}^{2}$ | ${2}^{105}=T/32$ |

112 | ${2}^{111}$ | ${2}^{104}$ | ${2}^{2}$ | ${2}^{106}=T/32$ |

113 | ${2}^{112}$ | ${2}^{105}$ | ${2}^{1}$ | ${2}^{106}=T/64$ |

114 | ${2}^{113}$ | ${2}^{106}$ | ${2}^{4}$ | ${2}^{110}=T/8$ |

115 | ${2}^{114}$ | ${2}^{107}$ | ${2}^{3}$ | ${2}^{110}=T/16$ |

117 | ${2}^{116}$ | ${2}^{109}$ | ${2}^{2}$ | ${2}^{111}=T/32$ |

121 | ${2}^{120}$ | ${2}^{113}$ | ${2}^{1}$ | ${2}^{114}=T/64$ |

126 | ${2}^{125}$ | ${2}^{118}$ | ${2}^{2}$ | ${2}^{120}=T/32$ |

127 | ${2}^{126}$ | ${2}^{119}$ | ${2}^{1}$ | ${2}^{120}=T/64$ |

128 | ${2}^{127}$ | ${2}^{120}$ | ${2}^{1}$ | ${2}^{121}=T/64$ |

129 | ${2}^{128}$ | ${2}^{121}$ | ${2}^{0}$ | ${2}^{121}=T/128$ |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Fúster-Sabater, A.; Requena, V.; Cardell, S.D.
An Efficient Algorithm to Compute the Linear Complexity of Binary Sequences. *Mathematics* **2022**, *10*, 794.
https://doi.org/10.3390/math10050794

**AMA Style**

Fúster-Sabater A, Requena V, Cardell SD.
An Efficient Algorithm to Compute the Linear Complexity of Binary Sequences. *Mathematics*. 2022; 10(5):794.
https://doi.org/10.3390/math10050794

**Chicago/Turabian Style**

Fúster-Sabater, Amparo, Verónica Requena, and Sara D. Cardell.
2022. "An Efficient Algorithm to Compute the Linear Complexity of Binary Sequences" *Mathematics* 10, no. 5: 794.
https://doi.org/10.3390/math10050794