**1. Introduction**

At the present stage of scientific development and technological progress, pseudorandom bit sequence generators have found more and more application areas. The scientific and practical importance of generating qualitative pseudorandom sequences are significant and many researchers are devoted to this area to find the best algorithms for generating pseudorandom sequences with properties that are closest to random sequences.

In particular, Professor Amalia Beatriz Orue Lopez from Isabel I University in Burgos, Spain [1–3], Professor Miguel Angel Murillo-Escoba from the Centre for Research and Higher Education in Ensenada, Baja California, Mexico [4,5] and Rafik Hamza from LAMIE Laboratory, University of Batna, Algeria [6] in their articles research the various methods of constructing pseudorandom sequence generators, in order to determine issues regarding information protection and estimation quality.

Pseudorandom sequence generators are used in various fields of science and technology. A special place among such generators is occupied by additive Fibonacci generators (AFG) [7–16].

**Citation:** Maksymovych, V.; Harasymchuk, O.; Karpinski, M.; Shabatura, M.; Jancarczyk, D.; Kajstura, K. A New Approach to the Development of Additive Fibonacci Generators Based on Prime Numbers. *Electronics* **2021**, *10*, 2912. https:// doi.org/10.3390/electronics10232912

Academic Editor: Myung-Sup Kim

Received: 16 October 2021 Accepted: 22 November 2021 Published: 24 November 2021

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

**Copyright:** © 2021 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/).

Almost all Fibonacci generators are designed for hardware implementation are used as recurrent equation modules equal to the power of two. This greatly simplifies the hardware implementation of Fibonacci generators but narrows their functionality and does not allow for the improvement of their statistical characteristics without a significant increase in the number of bits of structural elements. The main motivation for this work was the awareness of the need to solve the hardware implementation of Fibonacci generators with an arbitrary module value. This was also facilitated by the authors' experience gained in the hardware implementation of controlled digital frequency synthesizers [17].

Creating new circuit engineering solutions for the hardware implementation of Fibonacci generators allows for the implementation of a new approach to its creation, which, unlike previous approaches, enables the design of generators with an arbitrary module of the recurrent equation, in particular with modules whose values are prime numbers. As a result, there is an opportunity to significantly improve the generator's statistical characteristics.

This work was aimed at researching the hardware implementation of an additive Fibonacci generator, based on an algorithm that uses a module of prime numbers, and to analyse their characteristics.

#### **2. Related Works**

Additive Fibonacci generators (AFG) are widely used in cybersecurity devices to generate pseudorandom sequences of bits or numbers.

By itself, such a generator is not cryptographically strong. Nevertheless, using it is fundamental to create a completely secure and resistant cryptanalysis algorithm. For example, based on these generators, the algorithms Fish, Pike and Mush are implemented [7,8].

The use of Additive Fibonacci Generators is not limited to cybersecurity systems (cryptography), they are also used for other applications.

In particular, Ref. [18] describes a method for constructing a pseudorandom number generator based on a recurrent linear sequence of Fibonacci p-numbers to generate a variable carrier frequency of pulse-width modulation (PWM) of the power converter control system to reduce acoustic noise and electromagnetic obstacle level.

The classical algorithm of AGF was formed based on the equation:

$$\mathbf{x}\_{i} = (\mathbf{x}\_{i-1} + \mathbf{x}\_{i-k}) \bmod (\mathbf{m}), \\ l \gg k \gg 0 \tag{1}$$

General view:

$$\mathbf{x}\_{i} = (\mathbf{x}\_{i} \mathbf{\cdot}\_{-a} + \mathbf{x}\_{i-b} + \dots \mathbf{\cdot}\_{i} + \mathbf{x}\_{i-p}) \bmod (m), a > b > \dots > p > 0 \tag{2}$$

An effective hardware implementation of Equations (1) and (2) are chosen according to Equation 2 − *m* = 2*<sup>n</sup>*. This simplifies the hardware implementation of the generators. Compliance with the requirements for the selection of parameters *l*, *k* and *a*, *b*, ... , *p* in Equations (1) and (2) ensures that the repetition period of the sequence at the output of the sequence of generators will be no less than 2*n* − 1 [8].

In articles [10–19], modified additive Fibonacci generators (MAFG) were proposed, operating according to the equation:

$$\mathbf{x}\_{i} = (\mathbf{x}\_{i-d} + \mathbf{x}\_{i-b} + \dots \ + \mathbf{x}\_{i-p} + a) \bmod \mathbf{(2}^{\text{II}}),\tag{3}$$

where, *a* = *a*0 ⊕ *a*1 ⊕ ... ⊕ *az*; *ai* ((*i* = 0, 1, ... , *z*), (*z* ≤ *n* − 1))—values of the number *xi* binary bits.

In the studies of [10,11,19], it is shown that the process of adding the number "a" causes certain "confusion"—the dependence of each bit of the number, including the younges<sup>t</sup> bit, from all its other bits, allows to significantly improve the statistical characteristics of the output signals of the MAFG. An array of initial values of numbers *xi*, *xi*−*a*, *xi*−*b*, ... , *xi*−*p*, is called the cryptographic generator key and is under the condition of hardware

implementation. These numbers are used as the initial values of the registers that are part of its block diagram.

Our research on AGF and MAGF [10,11,13,18,19] show a significant dependence of the statistical characteristics of the pseudorandom sequence at the output of the generator on the output parameters. In particular, they strongly depend on the value of the repetition period of the output sequence [10,13]. This means the presence of so-called "weak keys", which could be relatively easily disclosed.

This paper presents the results of research aimed at eliminating this shortcoming of AFG and MAFG. We focus on the hardware implementation of generators.

#### **3. Case Study**

 f

*3.1. The Structure Schema and the Work Principle of the New AFG*

As emphasized above, the construction AGF and MAGF uses algorithms in which the modulus of recurrent Equations (1)–(3) is the power of number 2. This significantly simplifies hardware implementation.

Papers [17,18] proposed a new approach to constructing two-level frequency synthesizers using the change of the average value of the output frequency with an arbitrarily given step. These approaches can be effectively applied in the hardware implementation of our proposed generators.

Figure 1 shows a variant of one such additive Fibonacci generator [10].

**Figure 1.** Structure schema of AFG.

AFG consists of registers RG1-RG3, adders AD1-AD2, multiplexer MUX and logical element OR. The generator functions according to the equation:

$$\mathbf{x}\_{i} = (\mathbf{x}\_{i-2} + \mathbf{x}\_{i-1}) \bmod (m),\tag{4}$$

where, *m*—prime number; *xi*, *xi*−1, *xi*−2—numbers in registers RG1, RG2 i RG3.

The number of binary bits *n* of the structural elements of the scheme (RG1-RG3, AD1, AD2) is selected based on the need to ensure the condition 2*n* > *m*.

Herewith, the smallest value *n* is selected, at which this condition is fulfilled. The number *A*, which is applied to one of the AD2 input groups, is determined by the equation *A* = 2*n* − *m*. In the absence of carrying signals on the outputs of AD1 and AD2 to the RG1

information inputs through the multiplex, MUX passes a number from the output AD1, and in the presence of one of these signals the number from the output AD2. The initial number—the key (seed) *X*(0)—is written to registers RG1-RG3.

Clock pulses receive at the clock inputs of the registers RG1-RG3. The output pseudorandom bits sequence formed on one of the register's RG1 bits. The described operating mode of the generator provides a change of the numbers in registers RG1-RG3 in the range of values 0 ÷ *m* − 1.

#### *3.2. Research of the New AFG Characteristics*

Figure 2 shows the dependences of the repetition periods of the studied pseudorandom numbers sequence generators on the value of the key *X*(0).

**Figure 2.** Dependences of AFG repetition periods on the key.

Figure 2a,b shows the dependencies for the new AFG, that function following Equation (4): *m* = 13 (Figure 2a) and *m* = 17 (Figure 2b). In Figure 2c, the corresponding dependence for the classical AFG, which operates following Equation (4) at *m* = 24 = 16, is given for comparison. In order to go through all possible values, the initial number is determined by the formula:

$$X(0) = (\mathbf{x}\_{i-2}(0) + m \,\,\mathbf{x}\_{i-1}(0) + m^2 \,\,\mathbf{x}\_i(0),\tag{5}$$

where, *xi*(0), *xi*−1(0), *xi*−2(0) are the initial values of the numbers in the registers RG1-RG3, accordingly.

This article presents only some results of different AFG versions of repetition periods research. During the work, a large amount of AFG at different modulus values was analysed. This allows us to draw the following conclusions:


Table 1 presents the values of the repetition periods of the output sequence of new AFG for some *m* values fixed on the whole set of possible *X*(0) values.

**Table 1.** The dependence of the repetition periods of the new AFG output sequence for some *m* values on the whole set of possible *X*(0) values.


In Table 1, for values *m* = 2, 3, 13, 29, 31, 41, 47, 53, 59, 61, 71, 73, 79, 97, 103, 107, 109, 113, 127 no "weak keys" were found in the whole *X*(0) range values. The only fixed value of the period is indicated in the table. For other *m* values, a small number of "weak keys" were fixed, for which, along with the principal (predominant) reduced values of the period were indicated.

At sufficiently large *m* values, the procedure for finding the repetition periods of the output sequence for all possible *X*(0) values requires a lot of machine time and, under certain conditions, is such that it is practically not implemented. Table 2 shows the values of the repetition periods for relatively large values of *m* prime numbers when *xi*(0) = 1, *xi*−1(0) = 1, *xi*−2(0) = 1.

**Table 2.** Dependence of repetition periods of the new AFG output sequence for some *m* values, at *xi*(0) = 1, *xi*−1(0) = 1, *xi*−2(0) = 1.


The tendencies revealed at small values of the module *m* (Table 1) allow us to state with a high probability that, at relatively large values, the number of "weak keys" will be small or absent.

According to this property, the proposed Fibonacci generator, in which the modules of the recurrent equation are prime numbers, differs favourably from the known Fibonacci generators, in which the value of the modulus is equal to the power of two. For comparison, Table 3 shows some research results of the repetition periods of the output pseudo-random sequence of the classical additive Fibonacci generator, which functions according to Equation (4), at *n* = 2*<sup>m</sup>*. The results are obtained by imitation modelling.


**Table 3.** Dependence of repetition periods of the output sequence of classical AGF for some values of *m*on the whole set of values *X*(0).

Thus, in contrast to the proposed device, in the known device, at 2 > *m*, there are different values of the repetition periods, including those that have critically small values. This indicates the presence of "weak keys". In addition, the maximum values of the repetition periods are usually smaller than the relative values of module *m* in the proposed device. These trends are also observed for arbitrary and much larger values of the modulus *m*.

Research of the statistical characteristics of the output pseudorandom bit sequences of new AFGs were carried out with NIST tests package [20]. If the proportion fell outside of this interval (0.98–1.0), then this was evidence that the data were non-random. Testing was carried out at different values. As a result, the sequence was entirely non-random, so requirements of statistical security were not accepted. For example, Figure 3 presents a statistical portrait of the output sequence at *m* = 2,147,483,647.

**Figure 3.** Statistical portrait of AFG at *m* = 2,147,483,647.

As can be seen from Figure 3, the sequence of the investigated generator does not meet the requirements of randomness as most of the tests were valued at 0 and did not fall within the specified interval.

Thus, new AFGs, built using prime numbers as modules of recurrent equations, provide the absence or the small number of "weak keys". At the same time, they do not accord to the criteria of statistical security; however, they can be used in conjunction with other pseudorandom bit sequence generators (PRBSGs). In this case, their useful property can be used to ensure the constancy of the repetition period of the output sequence for all possible values of the initial settings, and for many values of the module *m*.

c f

*3.3. Structure Scheme and Operation Principle of the Combined PRBSG* The structure scheme of the combined PRBSG is given in Figure 4.

**Figure 4.** Structure scheme of the combined PRBSG.

The combined PRBSG consists of two generators: a generator based on a new AFG (Figure 1) and a generator based on the shift register with linear feedbacks LFSR. The output pulses of both generators are combined through a logic element XOR. The choice of type and LFSR bit number depends on the need to provide the specified characteristics of the output bit sequence. Instead of LFSR, other types of PRBSGs be used, which requires additional research.

In this work, the combined PRBSG used LFSR work according to the forming equation *F*(*x*) = 1 + 18*x* + 31*<sup>x</sup>*. The matrix *T*1 and the power of the matrix *r* = 10 [8] are used.

Figure 5 shows a statistical portrait of the LFSR, from which it follows that the output pseudo-random sequence does not pass only two tests from the NIST set.

**Figure 5.** Statistical portrait of the LFSR (*F*(*x*) = 1 + 18*x* + 31*<sup>x</sup>*, matrix *T*1, power of the matrix *r* = 10).

Figure 6 shows the result of testing combined PRBSG (Figure 4) with such parameters: new AFG *m* = 2,147,483,647, LFSR *F*(*x*) = 1 + 18*x* + 31*<sup>x</sup>*, matrix *T*1 and the power of the matrix *r* = 10. The output sequence passes all tests from the NIST set.

**Figure 6.** Statistical portrait of the combined PRBSG.

Thus, as can be seen from Figure 6, the results of all tests are within the allowable range. This suggests that the combined PRBSG generator provides the formation of the output pseudo-random sequence with high statistical characteristics.
