Abstract
This manuscript studies the construction of nonlinear feedback shift registers that generate binary de Bruijn sequences by means of the cross-join pairs method. We explicitly state the original contribution of our study as follows: We combine the classical theorem of Mykkeltveit and Szmidt with constructive algorithms, implementation details for small orders, and an interpretation in terms of Fryers’ polynomials. We also clarify the relation to earlier methods, discuss computational complexity and practical limitations, formalize the definition of the weighted adjacency matrix, and expand the conclusion with applications and directions for future work. Numerical results for small orders demonstrate the feasibility of the approach.
MSC:
05-08
1. Introduction
This work concerns the study and construction of de Bruijn sequences. They were first discovered in the late nineteenth century by C. F. Sanite-Marie [1], who established a theorem on their enumeration. They were later independently rediscovered by N. de Bruijn [2] in the 1940s, together with an independent proof of the theorem on their number. Since then, numerous works have investigated the construction of de Bruijn sequences and their connections with Nonlinear Feedback Shift Registers (NLFSRs), including, among others, our own works [3,4,5,6].
D. Coppersmith et al. in [7] derived an analytic formula for the generating function describing the perturbation process of sequences generated by linear recurrences. To a certain extent, their formula also describes the perturbation of sequences generated by nonlinear recurrences. The resulting Fryers’ polynomial quantitatively describes the process of applying cycle joining and the cross-join method in order to generate all de Bruijn sequences of a given order. Several illustrative examples are presented in Section 4. We extend the calculations given in [7] in an explicitly algorithmic direction. More precisely, we present constructive procedures for generating de Bruijn sequences through the repeated use of cross-join pairs, implement them for small orders, and discuss both their scope and their computational limitations. This constitutes the original contribution of this paper and distinguishes it from a purely historical review.
To some extent, their formula also describes the perturbation of sequences generated by nonlinear recurrences. The resulting Fryers’ polynomial provides a quantitative description of the process of applying cycle joining and the cross-join method to generate all de Bruijn sequences of the given order. Numerous examples are provided in Section 4.
We extend the calculations given in [7]. We present some algorithms that enable the generation of all de Bruijn sequences and implement them for small orders.
2. Nonlinear Feedback Shift Registers and De Bruijn Sequences
Let be a binary field and an n-dimensional vector space over this field. Elements of the space are n-vectors .
Definition 1.
A de Bruijn sequence of order n is a -long binary cyclic sequence, where each subsequence of n consecutive elements occurs exactly once.
C. F. Sainte-Marie and N. G. de Bruijn [1,2] proved that the number of cyclically non-equivalent de Bruijn sequences of order n amounts to
Definition 2.
A modified n-order de Bruijn sequence is a long binary cyclic sequence obtained from an n-order de Bruijn sequence by deleting one zero from the run of n consecutive zeros.
There is one-to-one correspondence between n-order de Bruijn sequences and modified de Bruijn sequences of the same order. Cryptography often uses modified de Bruijn sequences in order to avoid a zero initialization vector.
Definition 3.
A Boolean function of n variables is the following binary-valued function:
where function arguments will be indexed as .
The Boolean functions are usually represented in the form of truth table, which is a one-dimensional table of length containing ordered function values
where the integers run over the interval and are in binary form. It can be proved that an equivalent representation of a Boolean function is the so-called Algebraic Normal Form (ANF), where the function f is represented as a polynomial of n Boolean variables:
Here, the sum is over all t-subsets . In the sum (2), we identify the powers . If is a polynomial ring of n Boolean variables, while the ideal , then the Boolean functions in the algebraic normal form are elements of the quotient ring .
Definition 4.
A Feedback Shift Register (FSR) (see Figure 1) of order n is the transformation in the following form:
where the feedback function f is a Boolean function of n variables.
Figure 1.
An n-bit FSR.
The FSR is called non-singular if the transformation is a bijection of the space . It was proved in [8,9] that the necessary and sufficient condition of the non-singularity is the following form of a feedback function:
where F is a Boolean function of variables.
The non-singularity of the register implies that in (3) decomposes the space into disjoint cycles. When there is only one cycle, the register generates a de Bruijn sequence.
Theorem 1
([8]). Let be an n-order de Bruijn sequence. Then, there is a Boolean function such that
This means that de Bruijn sequences are generated by certain recurrences. The number of all possible Boolean functions of variables in Equation (4) amounts to . The comparison with (1) for the number of all n-order de Bruijn sequences leads us to the conclusion that the probability of randomly hitting the Boolean function in the form of (4) generating de Bruijn sequence is . Because of the algebraic normal form, the register feedback Boolean functions can be linear,
where , or nonlinear, containing higher-algebraic-degree monomials.
Theorem 2.
Linear recurrence (5) generates a binary sequence with a maximum period if and only if the polynomial
is a primitive polynomial, i.e., its roots are the generators of multiplicative group of finite field constructed from polynomial (6). These sequences are called m-sequences (see R. Lidl and H. Niederreiter [10] for the corresponding definitions).
Let us denote a state of a non-singular n-order FSR by . The state , where , is called the conjugate state to the state u. Let us assume that the register states in question occur in one cycle.
Definition 5.
Two pairs of conjugate states of the FSR determined by the feedback function f are
which constitute a cross-join pair for the sequence generated by the FSR if the states occur in the order during the generation of the sequence.
With an m-sequence generated by linear recurrence f in the form of (5) and a cross-join pair of states for the m-sequence given by , we can create the following nonlinear feedback function:
Definition 6.
Let f be the feedback function of an m-sequence and let and determine a cross-join pair. We define the associated cross-join transformation by
which generates a modified n-order de Bruijn sequence.
The above construction is referred to as an operation (or a method) of a cross-join pair. This operation can also be used for de Bruijn sequences. Constructing the feedback function for registers with a maximum period using cross-join pairs is a basic method for obtaining new nonlinear shift registers. It is described in the monograph by S. Golomb [8] published in 1967 and in [11].
3. The Theorem About Generating De Bruijn Sequences
Theorem 3
([4]). For two de Bruijn sequences and , the sequence can be obtained from through the repeated application of the cross-join pair operation.
The proof of this theorem is given in [4]. As an immediate consequence of Theorem 3, we also have the following:
Lemma 1.
For every de Bruijn sequence, and for every modified de Bruijn sequence of the same order, there exists at least one cross-join pair.
According to Helleseth and Kløve [11], we have Formula (7) for the number of different cross-join pairs for an m-sequence of order n:
For modified de Bruijn sequences of order n generated by feedback functions of NLFSRs, we do not have explicit formulas for the number of cross-join pairs, but our experiments show that for small orders , these numbers vary with NLFSRs of the given order and are around the value of (7). The ANF of the feedback function of a given de Bruijn sequence of order n is different from that of the corresponding modified de Bruijn sequence of the same order (obtained by removing one zero from the tuple of n consecutive zeros). If is a Boolean feedback function that generates a modified de Bruijn sequence of order n, then the Boolean feedback function of the corresponding de Bruijn sequence is equal to
According to (8), after calculating
the Boolean feedback function that generates a de Bruijn sequence contains the term ; it has algebraic degree We will also use formulas for the ANF of Boolean functions and the expressions that contain products of variables and their negations to abbreviate the notation.
Boolean feedback functions generating modified de Bruijn sequences of order n have an algebraic degree of at most ; some of them have degree 1 (those corresponding to LFSRs generating m-sequences), and there are also functions of low degrees, 3, or 4, which have a small number of terms in their ANF. In [12], Gammel et al. found NLFSRs up to an order of , algebraic degree up to 5, and containing up to around 30 terms in their ANF. According to Theorem 3, we know that such simple feedback functions of maximum-period NLFSRs can be obtained through the repeated application of the cross-join pair operation to a feedback function of an LFSR generating an m-sequence. The problem involves finding an effective algorithm to realize this task. The next section presents our efforts in this direction.
3.1. Applications
De Bruijn sequences and their nonlinear generators are relevant in stream cipher design, pseudorandom sequence generation, coding theory, and combinatorial testing. In this section, we focus on the constructive aspect: given a modified de Bruijn sequence and its corresponding NLFSR, we use cross-join operations to derive new maximum-period generators.
In this section, we consider modified de Bruijn sequences and feedback functions of NLFSRs generating these sequences. We use the cross-join pair operation to construct new NLFSRs from a given one. Let be a feedback function generating a modified de Bruijn sequence. Let be a cross-join pair for the sequence generated by the function . We use the formula from Definition 6 to construct a feedback function of a new modified de Bruijn sequence. The existence of such pairs is guaranteed by Lemma 1. When we apply the cross-join pair operation several times to a maximum-period LFSR, the resulting higher-degree terms may cancel out and we obtain a feedback function with a simple ANF. In fact, we do not have strict control over the process of algebraic cancellation of terms resulting from cross-join pairs, and finding NLFSRs with a simple ANF is a random process.
We implemented such an Algorithm 1. It works for and , giving all corresponding feedback functions. For , we have feedback functions altogether. The algorithm works for greater orders of n too. For , we have maximum-period NLFSRs and LFSRs. In our implementation of the algorithm, we used the SAGE package [13], especially the brial module implementing operations on algebraic normal forms of Boolean functions. All algorithms were implemented in the Python 2.7 programming language [14]. It takes about 15 min on a standard desktop computer to generate all modified de Bruijn NLFSRs of order 5. This experiment also illustrates the computational complexity of the approach: the number of candidate states and cross-join operations grows exponentially with order n, so exhaustive generation is practical only for small orders.
| Algorithm 1 Generation of modified de Bruijn sequences through repeated cross-join operations |
|
3.2. NLFSRs of Higher Order
We construct an NLFSR of order 7. We take the primitive polynomial The feedback function of the corresponding LFSR is We start from the initial state and generate all non-zero states of the LFSR. Let us consider the states for which and ; there are altogether 32. We can find eight cross-join pairs with no common states, which all cover the states with A list of those cross-join pairs follows:
After the calculations, we obtain the feedback function
which is a feedback function of the NLFSR generating a modified de Bruijn sequence of period . In [15], an NLFSR was found with a maximal period of the above form (with one quadratic term) up to an order of 32.
We formulate below some necessary conditions for applying the cross-join pair method to construct NLFSRs with a simple ANF that generates sequences of a maximal period of .
Then, conditions 1 and 2 of Algorithm 2 are necessary for the function (9) to generate a sequence with a maximum period of An example of such a family of cross-join pairs is given above in Section 3.2. Conditions 1 and 2 are not sufficient to guarantee the maximum period. When they are satisfied, one must check the period of the sequence generated by function
| Algorithm 2 Necessary conditions to construct NLFSRs with a simple ANF |
|
The above consideration is an example of how one can construct, using the cross-join pair method, NLFSRs with a maximum period with a simple ANF. It is not a practically applicable algorithm. It has been pointed out by one of the referees of [4] that such an algorithm would have a much greater complexity than that of the brute force search for maximum period NLFSRs. Another promising method for constructing maximum-period NLFSRs is to join cycles of non-singular LFSRs; see e.g., [3,6,8,16,17,18,19,20,21,22]. The problem with this is having to control the algebraic degree and number of terms in the ANF of the constructed NLFSRs.
4. Perturbation of Linear and Nonlinear Recursions
In this section, we summarize the relevant results from [7] of D. Coppersmith, R. C. Rhoades, and J. M. VanderKam and combine them with our own calculations for small orders. This clarifies which statements are reproduced from the literature and which numerical illustrations were generated in our implementation.
Let be the set of functions in Equation (4) that generate de Bruijn sequences of order n. For , define to be the set of such that the weight of is k. In other words, the number of disagreements between the functions f and g is k. Moreover, let and
Let a linear function generate a sequence of period without a run of n zeros. In [7], a formula is given according to Michael Fryers:
which can be deduced from Theorem 1.1 of [7]. The formula of Helleseth and Kløve [11] for the number of cross-join pairs for de Bruijn sequences generated by a linear recursion can be deduced from (11), and one can also obtain its generalizations.
We derive a formula for using the Maclaurin expansion of the function (10):
Hence, can be obtained by calculating the derivatives of at or through the direct calculation of (11) as a polynomial. We have the following:
- which means that from an m-sequence, we obtain one de Bruijn sequence by adding the all-zero state, which makes one change in the truth table of function l.
- ; now, we change the truth table in two places. One introduces the zero cycle and the other splits the whole cycle into two cycles. In general, all for even k, since we obtain some number of disjoint cycles.
- is the Helleseth and Kløve Formula (7) counting the number of cross-join pairs in an m-sequence or equivalently the number of two changes in the truth table (plus one for the zero cycle), which disjoin the cycle and then join them into one cycle. Hence, Fryers’ formula leads to an analytic proof of Formula (7).
- The formula for , for odd , readswhich is a generalization of (7).
- , which follows from calculations, means that at the last step of the process, we obtain only one de Bruijn sequence.
- for , which means that no more de Bruijn sequences are produced.
- We have thatwhich is the number (1) of all cyclically non-equivalent de Bruijn sequences of order
4.1. The Special Cases
Let us consider the special cases of the equation for for small values of order
- Here, 35 is the number of cross-join pairs for an m-sequence of order 5, 273 is the number of new de Bruijn sequences obtained after the second application of the cross-join method. Applying the cross-join method eight times produces all de Bruijn sequences.
- Let us remark the symmetry in the appearing numbers.
We have confirmed experimentally the numbers appearing for and . They are consistent with Theorem 3, which states that for any two de Bruijn sequences of a given order, one can be obtained from the other through the repeated application of the cross-join pair method.
An implementation of the Algorithm 3 generates all feedback functions of modified de Bruijn sequences for the orders and and partly for . For , it is not realistically feasible since there are de Bruijn sequences of order 7 in total. One can try to run this algorithm for greater values of n and generate only some fraction of the NLFSRs.
| Algorithm 3 Enumeration guided by Fryers’ polynomial coefficients |
|
4.2. Fryers’ Polynomials
Function (11) is an example of a Fryers’ polynomial associated with a linear recurrence generating an m-sequence. Such polynomials encode how many de Bruijn sequences are obtained after a given number of truth table changes. More generally, one may start from a linear or nonlinear recurrence and consider the corresponding polynomial description of the generation process. We quote the relevant result from [7] and adapt the notation to our setting.
Definition 7.
For any function , define the weighted adjacency matrix of size as follows. Its rows and columns are indexed by the states of the shift register. If a state is followed by the state with , then the entry corresponding to is equal to 1; otherwise, it is equal to y.
For any function define the weighted adjacency matrix It is the matrix with 1 in the row and column corresponding to if , and y otherwise.
Lemma 2.
We have that is equal to the determinant of after deleting the first row and the first column.
We present an application of Lemma 2. We consider the pure circulating register of the order given by the feedback function Then, the corresponding Fryers’ polynomial is
which can be interpreted as follows: after joining the cycles of f with 5 changes in the truth table, we obtain 12 new de Bruijn sequences, and after the second stage, we apply the cross-join pair method and obtain 4 new de Bruijn sequences. We have carried out similar calculations for all linear recurrences of order 4. The results are in shown Table 1. When starting from nonlinear modified de Bruijn sequences, we have two patterns of Fryers’ polynomials:
which we represent, respectively, as
Table 1.
Linear recurrences of order n = 4.
For the pure circulating register of order 5, we have the corresponding Fryers’ polynomial:
The sum of coefficients
is the total number of de Bruijn sequences of order 5, and 576 is the number of spanning trees for the adjacency graph of the pure circulating register.
F. Ezerman and A. Fahrenza from Singapore Nanyang Technological University have calculated the Fryers’ polynomials of all de Bruijn sequences of order 5. The representative patterns are summarized in Table 2.
Table 2.
Last 30 of 60 distribution patterns for order 5.
5. Conclusions
In this paper, we clarified the original contribution of the work and strengthened both the exposition and practical interpretation of the results. The main purpose of this paper is to present a constructive and implementation-oriented perspective on the cross-join method, together with explicit small-order computations and a connection with Fryers’ polynomials. We also explained how the proposed algorithms differ from classical constructions based purely on linear recurrences: they operate directly on cross-join transformations and therefore provide a flexible way to construct nonlinear feedback shift registers that generate de Bruijn sequences. At the same time, the computational cost grows rapidly with the order, so the present implementation is mainly useful for small values of n. From the application point of view, the constructions are relevant to stream cipher design, pseudorandom sequence generation, and combinatorial sequence design. Future work should focus on improving scalability, analyzing the structure of cross-join graphs for larger orders, and developing more efficient heuristics for finding maximum-period NLFSRs with simple algebraic normal forms.
Author Contributions
Conceptualization, P.D., T.R. and J.S.; methodology, P.D., T.R. and J.S.; software, P.D., T.R. and J.S.; validation, P.D., T.R. and J.S.; formal analysis, P.D., T.R. and J.S.; investigation, P.D., T.R. and J.S.; resources, P.D., T.R. and J.S.; data curation, P.D., T.R. and J.S.; writing—original draft preparation, P.D., T.R. and J.S.; writing—review and editing, P.D., T.R. and J.S.; visualization, P.D., T.R. and J.S.; supervision, P.D., T.R. and J.S.; project administration, P.D., T.R. and J.S.; funding acquisition, P.D., T.R. and J.S. All authors have read and agreed to the published version of the manuscript.
Funding
The research of all authors was supported by the Military Communication Institute, Poland.
Data Availability Statement
No new data were created or analyzed in this study.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- de Bruijn, N.G. Acknowledgement of Priority to C. Flye Sainte-Marie on the Counting of Circular Arrangements of 2n Zeros and Ones that Show Each n-Letter Word Exactly Once; EUT Report, WSK; Department of Mathematics and Computing Science, Technische Hogeschool Eindhove: Eindhoven, The Netherlands, 1975; Volume 75-WSK-06. [Google Scholar]
- de Bruijn, N.G. A combinatorial problem. Indag. Math. 1946, 8, 461–476. [Google Scholar]
- Dabrowski, P.; Labuzek, G.; Rachwalik, T.; Szmidt, J. Searching for non-linear feedback shift registers with parallel computing. Inf. Process. Lett. 2014, 114, 268–272. [Google Scholar] [CrossRef] [Scilit]
- Mykkeltveit, J.; Szmidt, J. On cross joining de Bruijn sequences. Contemp. Math. 2015, 632, 335–346. [Google Scholar]
- Szmidt, J. Nonlinear feedback shift registers and zech’s logarithms. In International Conference on Military Communications and Information Systems; IEEE: New York, NY, USA, 2019; pp. 1–4. [Google Scholar]
- Szmidt, J.; Dąbrowski, P. The construction of nonlinear feedback shift registers of small orders. In Proceedings of the International Conference on Military Communications and Information Systems, Cracow, Poland, 18–19 May 2015. [Google Scholar] [CrossRef] [Scilit]
- Coppersmith, D.; Rhoades, R.C.; VanderKam, J.M. Counting De Bruijn sequences as perturbations of linear recursions. arXiv 2017, arXiv:1705.07835. [Google Scholar] [CrossRef] [Scilit]
- Golomb, S. Shift Register Sequences; Welch, L.R., Goldstein, R.M., Hales, A.W., Eds.; Holden-Day: San Francisco, CA, USA, 1967. [Google Scholar]
- Walker, E.A. Non-Linear Recursive Sequences. Can. J. Math. 1959, 11, 370–378. [Google Scholar] [CrossRef] [Scilit]
- Lidl, R.; Niederreiter, H. Finite Fields; Cambridge University Press: Cambridge, UK, 1997. [Google Scholar]
- Helleseth, T.; Kløve, T. The number of cross-join pairs in maximum length linear sequences. IEEE Trans. Inf. Theory 1991, 37, 1731–1733. [Google Scholar] [CrossRef] [Scilit]
- Gammel, B.M.; Göttfert, R.; Kniffler, O. ACHTERBAHN-128/80, ECRYPT Stream Cipher Project Report. 30 June 2006. Available online: https://www.matpack.de/achterbahn/Gammel_Goettfert_Kniffler_Achterbahn-128-80.pdf (accessed on 15 April 2026).
- Stein, W. Sagemath. Available online: www.sagemath.org (accessed on 15 April 2026).
- Python Programming Language. Available online: www.python.org (accessed on 15 April 2026).
- Askeland, A. An FPGA Accelerated Search Method for Maximum Period NLFSRs; Lecture Notes in Computer Science 15176; Springer: Berlin/Heidelberg, Germany, 2025; ISBN 978-3-031-81823-3. [Google Scholar]
- Fletcher, J.C.; Perlman, M. Nonlinear Nonsingular Feedback Shift Registers. U.S. Patent 3911330, 7 October 1975. Available online: https://www.freepatentsonline.com/3911330.html (accessed on 15 April 2026).
- Fredricksen, H. A class of nonlinear de Bruijn cycles. J. Comb. Theory Ser. A 1975, 19, 192–199. [Google Scholar] [CrossRef] [Scilit]
- Hauge, E.R.; Helleseth, T. De Bruijn sequences, irreducible codes and cyclotomy. Discret. Math. 1996, 159, 143–154. [Google Scholar] [CrossRef] [Scilit]
- Hemmati, F. A large class of nonlinear shift register sequences (corresp.). IEEE Trans. Inf. Theory 2003, 28, 355–359. [Google Scholar] [CrossRef] [Scilit]
- Jansen, C.J.A. Investigations on Nonlinear Streamcipher Systems: Construction and Evaluation Methods. Doctoral Thesis, Delft University of Technology, Delft, The Netherlands, 1989. [Google Scholar]
- Magleby, K.B. The Synthesis of Nonlinear Feedback Shift Registers; Stanford University: Stanford, CA, USA, 1963. [Google Scholar]
- Chang, Z.; Wang, H.; Ezerman, M.F.; Fahreza, A.A.; Ling, S.; Szmidt, J. Binary de Bruijn Sequences via Zech’s Logarithms. SN Comput. Sci. 2021, 2, 314. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 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.
