Linear feedback shift register (RSLOS, English linear feedback shift register , LFSR ) is a bit-word shift register , in which the value of the input (inserted) bit is equal to the linear Boolean function from the values of the remaining bits of the register to the shift. It can be organized by both software and hardware. It is used to generate pseudorandom sequences of bits , which finds application, in particular, in cryptography [1] .
Description
In the shift register with linear feedback (RSLOS) there are two parts (modules):
- the shift register itself;
- a feedback circuit (or subroutine) that calculates the value of the inserted bit .
The register consists of functional memory cells (bits of one or more machine words), each of which stores the current state (value) of one bit. Number of cells is called the length of the register. Bits (cells) are usually numbered with numbers
, contents
th cell is denoted by
. The value of the new bit
determined before the shift of bits in the register and only after the shift is recorded in the cell
, and from the cell
the next generated bit is retrieved.
The feedback function for RSLOS is a linear Boolean function of the values of all or some bits of the register. The function multiplies the register bits by the coefficients where . The number of coefficients matches the number of bits of the register . Odds take values , and the last coefficient is equal to , since RSLOS is given by a characteristic polynomial of degree . Addition modulo 2 (operation "XOR", denoted in the formulas by the symbol " ”) Or its logical inversion“ XNOR ”are linear Boolean functions and are most often used in such registers [2] . In this case, the bits, which are variables of the feedback function, are called taps , and the register itself is called the Fibonacci configuration [3] .
Register control in hardware implementations is performed by applying a shifting pulse (otherwise called a clock or clock ) to all cells. Register management in software implementations is performed by executing a loop . At each iteration of the loop, the feedback function is calculated and the bit shift in the word is performed.
Principle of Operation
During each cycle, the linear feedback shift register performs the following operations:
- the bit located in the cell is read ; this bit is the next bit of the output sequence;
- feedback function calculates the new value for the cell using current cell values;
- the contents of each th cell moves to the next cell where ;
- to cell the bit previously calculated by the feedback function is recorded.
If the feedback function performs the logical operation “ XOR ” (exclusive OR), the values of bits (cells) can be calculated using the following formulas [4] :
Properties
Frequency
The shift register period is the minimum length of the resulting sequence before it begins to repeat. RSLOS length It has initial states that specify the values of the bits in the cells. Of them states are nonzero, so the generated sequence has a period . The period of the generated sequence is maximum and equal to if the feedback polynomial (or the characteristic polynomial) over the field is primitive . For this, it is necessary (but not enough) that the following 2 conditions are met:
- an even number of taps;
- branch numbers, taken all together, and not in pairs, are mutually simple .
The number of all possible primitive polynomials is where is the Euler function [5] . The register specified by such a polynomial is called the maximum period shift register (or pseudo-random sequence generator ), and the generated sequences are called maximum period sequences (or M-sequences ) [4] [6] .
Linear complexity
The linear complexity of an infinite binary sequence called a number which is defined as follows:
- if a Is the zero sequence then ;
- if there is no RSLOS that generates then ;
- otherwise equal to the length of the shortest RSLOS that generates .
Linear complexity of a finite binary sequence called a number equal to the length of the shortest RSLOS that generates this sequence.
The linear complexity of the shift register with linear feedback shows how close the generated sequence is to random . An effective algorithm for determining the linear complexity of a finite binary sequence is the Berlekamp-Massey algorithm .
Correlation Independence
Trying to get high linear complexity of the generated sequence, cryptographs nonlinearly combine the outputs of several shift registers. In this case, one or more output sequences (or even the outputs of individual RSLOSs) can be connected by a common stream and opened by a cryptanalyst . Hacking based on this vulnerability is called correlation autopsy . The main idea of such a hack is to detect some correlation between the output of the generator and the conclusions of its components. Then, observing the output sequence, you can obtain information about these intermediate conclusions, and thus hack the generator. Thomas Sigentaler showed that correlation independence can be precisely determined, and that there is a trade-off between correlation independence and linear complexity [7] .
Software Implementation
RSLOS software implementations are rather slow and work faster if they are written in assembler . One solution is the parallel use of 16 RSLOS (or 32, depending on the word length in the computer architecture). In such a scheme, an array of words is used, the size of which is equal to the length of the shift register , and each bit of the word refers to its own RSLOS. Since the same numbers of tap sequences are used, this can give a noticeable gain in generator performance [3] .
Fibonacci Configuration
Consider a 32-bit shift register. There is a tap sequence for it . This means that to generate a new bit, it is necessary to add the 31st, 30th, 29th, 27th, 25th and 0th bits using the XOR operation. The resulting RSLOS has a maximum period . The code for such a C register is as follows:
int LFSR_Fibonacci ( void )
{
static unsigned long S = 0x00000001 ;
S = (((( S >> 31 ) ^ ( S >> 30 ) ^ ( S >> 29 ) ^ ( S >> 27 ) ^ ( S >> 25 ) ^ S ) & 0x00000001 ) << 31 ) | ( S >> 1 );
return S & 0x00000001 ;
}
Galois Configuration
As in the Fibonacci configuration, the feedback scheme is a set of XOR operations of the tap bits with the generator output, but the order of the bits in the register is reversed: the input is bit, and the weekend th. The result of the addition is written to the next cell, and the new output bit is written to -Yu. Thus, if the generated bit is equal to zero, then all the bits in the cells are shifted to the right without changes, if the generated bit is equal to one, then the retraction bits change their value to the opposite, and all bits are shifted to the right. Both the Fibonacci configuration and the Galois configuration of the same length generate identical, but time-shifted sequences from one another (the internal states of the registers may differ) [8] .
This generator does not have greater cryptographic strength , but it gives a gain in performance: all XOR operations through parallelization can be performed in one action, and not sequentially one after another, as in the Fibonacci configuration. This scheme will also give a gain in hardware implementation.
The code for the 32-bit shift register in C is as follows:
int LFSR_Galois ( void )
{
// for polynomial 0x80000057, reversed 0xea000001
static unsigned long S = 0x00000001 ;
if ( S & 0x00000001 ) {
S = (( S ^ 0xea000001 ) >> 1 ) | 0x80000000 ;
return 1 ;}
else {
S >> = 1 ;
return 0 ;}
}
It is worth noting that a cycle of a fixed number of calls to the LFSR_Galois function in the Galois configuration is approximately 2 times faster than the LFSR_Fibonacci function in the Fibonacci configuration ( MS VS 2010 compiler on Intel Core i5 ).
Example generated sequence
Fibonacci Configuration
Let RSLOS be given by a characteristic polynomial . This means that the retraction bits will be the 2nd and 0th, and the unit in the polynomial formula means that the 0th bit is the input. The feedback function has the form . Suppose the initial state of the shift register was a sequence . Further register states are shown in the table below:
| Step number | condition | Bit generated |
|---|---|---|
| 0 | one | |
| one | 0 | |
| 2 | 0 | |
| 3 | one | |
| four | one | |
| five | one | |
| 6 | 0 | |
| 7 | one |
Since the internal state at the seventh step returned to its original state, then, starting from the next step, the bits will be repeated. That is, the generated sequence is as follows: (the order of the bits in the sequence corresponds to the order of their generation of the RSLOS). Thus, the period of the sequence is 7, that is, the maximum possible value, which happened due to the primitiveness of the given polynomial.
Galois Configuration
Take the same characteristic polynomial, i.e. , . Only the 1st bit is added to the output bit. The initial state is the same. Further register states:
| Step number | condition | Bit generated |
|---|---|---|
| 0 | - | |
| one | 0 | |
| 2 | one | |
| 3 | one | |
| four | one | |
| five | 0 | |
| 6 | 0 | |
| 7 | one |
The internal state of the register at the seventh step returned to its original state, therefore, its period is also equal to 7. Unlike the Fibonacci configuration, the internal states of the register turned out to be different, but the generated sequence is the same, only shifted by 4 measures : (the order of the bits in the sequence corresponds to the order of their generation of the RSLOS).
Primitive polynomial generation
Computing a primitive polynomial over a field - a rather complicated mathematical problem: to generate a primitive polynomial of degree need to know the number factors . It is easier to randomly select a polynomial and check it for primitiveness [3] . Another method is to use ready-made tables that list the numbers of tap sequences that provide the maximum generator period. Below is a table of primitive polynomials over a field for shift registers with a maximum period of up to 19 bits [5] . It is worth considering that a generator of any given length can have more than one primitive polynomial according to their properties . A complete list for registers from 4 to 32 bits long can be found here .
| Bits | Primitive polynomial | Period, | The number of primitive polynomials |
|---|---|---|---|
| 2 | 3 | one | |
| 3 | 7 | 2 | |
| four | 15 | 2 | |
| five | 31 | 6 | |
| 6 | 63 | 6 | |
| 7 | 127 | 18 | |
| eight | 255 | sixteen | |
| 9 | 511 | 48 | |
| ten | 1023 | 60 | |
| eleven | 2047 | 176 | |
| 12 | 4095 | 144 | |
| 13 | 8191 | 630 | |
| 14 | 16383 | 756 | |
| 15 | 32767 | 1800 | |
| sixteen | 65535 | 2048 | |
| 17 | 131071 | 7710 | |
| 18 | 262143 | 7776 | |
| nineteen | 524287 | 27594 | |
| 20 - 168 | [one] | ||
| 2 - 786, 1024, 2048, 4096 | [2] | ||
Advantages and disadvantages
Benefits
- high speed cryptographic algorithms created on the basis of RSLOS (for example, stream ciphers );
- the use of only the simplest bit operations of addition and multiplication, hardware implemented in almost all computing devices;
- good cryptographic properties (RSLOS can generate sequences of a large period with good statistical properties);
- Due to its structure, DFIDs are easily analyzed using algebraic methods.
Weaknesses
- One of the main problems of RSLOS is that their software implementation is extremely ineffective: sparse feedback polynomials must be avoided, since they lead to easier cracking by correlation breaking, and dense polynomials are very slowly calculated. Therefore, the software implementation of such a generator does not work faster than the DES implementation.
- The linearity of the sequence at the output of the register allows you to uniquely determine the feedback polynomial by consecutive bits using the Berlekamp – Massey algorithm or the Euclidean algorithm [3] [4] .
- The relative ease of analysis by algebraic methods not only facilitates development, but also increases the chances of breaking a generator based on RSLOS.
Ways to Improve the Cryptographic Strength of Generated Sequences
Multi Shift Generators
This type of oscillator consists of several linear feedback shift registers that generate bits respectively. Next, the generated bits are transformed by some Boolean function . It should be noted that generators of this type of register length , are mutually simple among themselves.
The period of this generator is where - total number of cells. Therefore, the use of several RSLOS increases the period of the generated sequence in comparison with one register, which increases the cryptographic stability of the generator. Also increases the linear complexity or length of the shortest register corresponding to this generator. Such a register is found using the Berlekamp-Massey algorithm in the generated sequence. In the best case, its length is commensurate with the period of the generated sequence [4] .
Nonlinear Transform Generators
The structural diagram of such a generator is no different from the circuit of the previous generator. The main difference is that the conversion device is defined by a nonlinear Boolean function . As such a function, for example, the Zhegalkin polynomial is taken (according to the Zhegalkin theorem, every Boolean function can be uniquely represented by the Zhegalkin polynomial).
A non-linear generator can also be implemented on a . He can give sequence variants of the maximum period , which is greater than that of RSLOS [5] .
The cryptographic stability of this generator is increased due to the nonlinearity of the function used. Determining the state of registers by the generated sequence of bits is a difficult mathematical task, because an algorithm that restores the initial states is not known.
This method is used, for example, in the Geff generator and the generalized Geff generator, however, such generators can be cracked by correlation autopsy [7] .
Generators with different shift register timing
Stop-go Generator
The Stop-and-Go generator ( Stop-and-Go , Both-Piper ) uses the RSLOS-1 pin to control the RSLOS-2 clock frequency, so the RSLOS-2 changes its state at some point in time , only if the output of RSLOS-1 at time was equal to one. This scheme could not resist the correlation autopsy [3] .
In order to increase cryptographic strength, an alternating stop-go generator was proposed. It uses three shift registers of various lengths. Here, RSLOS-1 controls the clock frequency of the 2nd and 3rd registers, that is, RSLOS-2 changes its state when the output of RSLOS-1 is unity, and RSLOS-3 - when the output of RSLOS-1 is zero. The output of the generator is the operation of adding modulo two outputs RSLOS-2 and RSLOS-3. This generator has a large period and a large linear complexity. There is a correlation autopsy method for RSLOS-1, but this does not greatly weaken the cryptographic properties of the generator.
A sophisticated timing scheme is used in a two-way stop-go generator , which uses 2 shift registers of the same length. If the output of RSLOS-1 at some point in time equal to zero, and at time - one, then RSLOS-2 is not clocked at a time . If the output of RSLOS-2 at a time equal to zero, and at time - one, and if this register is clocked at time , then at the same moment RSLOS-1 is not clocked. The linear complexity of this circuit is approximately equal to the period of the generated sequence.
Self-cutting generator
Self-decimating generators control their own frequency. There are two types of such generators. The first was proposed by Rainer Ruppel . It consists of a shift register and a linear feedback circuit that clocks this register depending on what the output values of the shift register are. If the output of the RSLOS is equal to one, then the register is clocked with one frequency, and if the output is zero, then with another. The second type was proposed by Bill Chambers and Dieter Callman . It is not the output signal itself that receives the feedback circuit, but the result of the XOR operation of certain RSLOS bits.
There are also decimated ( English shrinking ) and self- decimated ( English self-shrinking ) generators. They are fairly new, and not all of their properties are well understood. The first uses two RSLOS. If a clock pulse is applied to the generator, and the output of RSLOS-1 is one, then the output of the generator will be the output of RSLOS-2. Otherwise, when applying a clock pulse, both bits are reset, the clock starts again. In the second generator, instead of checking the outputs of two registers for 0 or 1, 2 bits of one register are checked.
A decimated generator can be hacked if the feedback polynomials are decimated. In addition, its generation rate is not constant. For a self-decimating generator, approximately 2 times less memory is needed than the first, but at the same time it works 2 times slower [7] .
Multi-speed Internal Product Generator
This generator uses two shift registers RSLOS-1 and RSLOS-2. RSLOS-2 clock frequency times more than RSLOS-1. Certain bits of these registers are multiplied with each other by the AND operation. The results of the multiplications are summed by the XOR operation, and an output sequence is obtained. This generator has high linear complexity and has good statistical properties. However, its condition can be determined by an output sequence of length where and - the lengths of RSLOS-1 and RSLOS-2, respectively, and - the ratio of their clock frequencies.
Gollmann Cascade
This diagram is an improved version of the stop-go generator. It consists of a sequence of RSLOS, the timing of each of which is controlled by the previous RSLOS. If the output of RSLOS-1 at a time is 1, then RSLOS-2 is clocked. If the output of RSLOS-2 at a time is 1, then RSLOS-3 is clocked, and so on. The output of the last RSLOS is the output of the generator. If the length of all RSLOS is the same and equal , then the period of the system from RSLOS is equal and linear complexity is [7] .
This idea is simple and can be used to generate sequences with huge periods, large linear complexity and good statistical properties. But, unfortunately, they are sensitive to an autopsy called lock-in , when a cryptanalyst , first restoring the input sequence of the last register in a cascade, breaks the entire cascade, register by register. With the increasing number of registers the generated sequence approaches random , so it is better to use more short-wavelength MLRS than fewer long MLRS.
Majority Generators
The majority (or threshold ) generator consists of a large number of shift registers, the outputs of which are supplied to the device specified by the majorization function, for example, a majority element . The peculiarity of this generator is that each of the shift registers has its own clock bit , , which are the variables of the majority function. For example, for three registers, such a function has the form . Only those registers whose clock bits equal the value are shifted , that is, the shift of the registers occurs for most of the values of these bits: 0 or 1.
Thus, we get a generator with a variable number of RSLOS. Its linear complexity where - length -th register [7] . The disadvantages of such a generator are the possibility of direct enumeration and correlation autopsy (each output bit gives some information about the state of the shift register, or rather, 0.189 bits).
Similar generators are used in A5 encryption algorithms (A5 / 1, A5 / 2).
Application
Shift registers with linear feedback can be implemented in hardware, which allows them to be used to quickly generate a pseudo-random sequence , for example, when expanding the spectrum using the direct sequence method or to generate a noise signal [9] .
Use in cryptography
Linear feedback shift registers have long been used as pseudo-random sequence generators for stream ciphers (especially in military cryptography ). However, RSLOS is a linear scheme and in some cases can be easily cracked. For example, a cryptanalyst can intercept a part of the ciphertext and, using the aforementioned Berlekamp-Massey algorithm, restore the minimum size RSLOS that imitates the original RSLOS. Then, the intercepted text can be submitted to the received register and decrypted. Methods to increase the cryptographic strength of stream ciphers based on RSLOS are given above .
Linear feedback shift registers are based on stream ciphers such as A5 / 1 and A5 / 2 used in the GSM standard and the cipher used in Bluetooth . The cipher A5 / 2 was cracked, and the ciphers A5 / 1 and E0 have serious shortcomings [10] [11] .
Регистр сдвига с линейной обратной связью тесно связан с линейным конгруэнтным генератором [12] .
Использование в качестве счётчиков
Периодичность генерируемой последовательности РСЛОС позволяет использовать его в качестве делителя тактовой частоты или счётчика [13] . Счётчик на основе такого генератора имеет упрощенную схему обратной связи, в отличие от обычных двоичных счётчиков или счётчиков кода Грея , и, следовательно, может работать на высоких тактовых частотах. Однако необходимо убедиться, чтобы такой счётчик никогда не входил в нулевое состояние.
Тестирование цифровых устройств
В отличие от обычного счётчика, РСЛОС переходит из одного состояния в другое не в порядке двоичного счёта, что позволяет его использовать для генерации тестового сигнала при обнаружении ошибок в логических схемах [6] .
Также регистры сдвига с линейной обратной связью применяются во ( англ. built-in self-test , BIST ) для сигнатурного анализа (выявления ошибочных битов) в логических схемах. Подобные системы применяют ввиду ограниченности числа выводов микросхем (не все промежуточные значения битов можно подать на выход). Система BIST представляет собой 3 блока: генератор тестовой последовательности и сигнатурный анализатор, которые и строятся на основе РСЛОС, и контроллер тестов. Регистр сдвига в анализаторе «сжимает» результат схемы на тестовую последовательность в сигнатуру и продолжает работать до тех пор, пока всего его биты, кроме 0-го, не станут равными нулю, то есть до состояния . Наряду с РСЛОС работает двоичный счётчик, подсчитывающий количество тактов с момента окончания сжатия тестовой реакции. Если изначальное состояние регистра соответствовало эталонной сигнатуре (сигнатуре безошибочной схемы), то показание счётчика соответствует номеру ошибочного бита [14] [15] .
Так как РСЛОС производит сжатие с потерей данных, то есть вероятность, что в схеме с ошибками получившаяся сигнатура будет равна эталонной. Этого можно избежать, используя сигнатурный анализатор с несколькими входами.
Скремблирование
Регистры сдвига с линейной обратной связью применяются при скремблировании с целью получения цифрового потока со свойствами случайной последовательности. Псевдослучайная последовательность РСЛОС максимальной длины складывается по модулю 2 с потоком передаваемых битов, причём генерация последовательности происходит с той же скоростью, что и передача данных. Некоторые системы и технологии, использующие скремблирование:
- ATSC [16] ;
- DAB ;
- DVB-T ;
- NICAM ;
- CDMA ;
- Fast Ethernet ;
- 1000BASE-T Gigabit Ethernet ;
- PCI Express 3.0 ;
- SATA ;
- Serial Attached SCSI ;
- USB 3.0 ;
- IEEE 802.11a ;
- Bluetooth LE .
See also
- Регистр сдвига с обратной связью по переносу (FCSR)
- Поточный шифр
- Вихрь Мерсенна
Notes
- ↑ Б. Скляр, 2007 .
- ↑ Linear Feedback Shift Registers in Virtex Devices
- ↑ 1 2 3 4 5 Б. Шнайер, 2013 .
- ↑ 1 2 3 4 Габидулин, Кшевецкий, Колыбельников, 2011 .
- ↑ 1 2 3 Ю.Б. Кобзарев, 2013 .
- ↑ 1 2 Ларин, 2008 .
- ↑ 1 2 3 4 5 Фомичёв, 2003 .
- ↑ Beker, Piper, 1982 .
- ↑ А. Сизоненко, 2012 .
- ↑ E. Barklan, E. Biham, N. Keller, 2008 .
- ↑ Y. Lu, W. Meier, S. Vaudenay, 2005 .
- ↑ D. Eastlake, J. Schiller, S. Crocker, 2005 .
- ↑ Efficient Shift Registers, LFSR Counters and Long Pseudo-Random Sequence Generators
- ↑ B. Harrington, 2008 .
- ↑ О. Дяченко .
- ↑ В. Варгаузин, 1999 .
Literature
- Шнайер Б. Прикладная криптография. Protocols, algorithms, source codes in the C language. — Триумф, 2013. — 816 с. — ISBN 978-5-89392-527-2 .
- Габидулин Э. М. , Кшевецкий А. С. , Колыбельников А. И. Защита информации : учебное пособие — М. : МФТИ , 2011. — 225 с. - ISBN 978-5-7417-0377-9
- Ларин А. Л. Основы цифровой электроники — М. : МФТИ , 2008. — 314 с. — ISBN 978-5-7417-0228-4
- Скляр Б. Цифровая связь. Теоретические основы и практическое применение. — Вильямс, 2007. — 1104 с. — ISBN 978-5-8459-0497-3 .
- Кобзарев Ю. Б. Современная радиолокация. — Рипол Классик, 2013. — 708 с. — ISBN 978-5-4584-7357-6 .
- Фомичёв В. М. Дискретная математика и криптология : Курс лекций / под ред. Н. Д. Подуфалов — М. : Диалог-МИФИ , 2013. — 397 с. — ISBN 978-5-86404-185-7
- Beker H. , Piper F. Cipher systems: the protection of communications — London : Northwood Books , 1982. — 427 p. — ISBN 978-0-7198-2611-5
- Сизоненко А. Б. Многоканальный цифровой источник шума на основе рекуррентного регистра сдвига . — Журнал «Спецтехника и связь» №3, 2012. Архивная копия от 29 ноября 2014 на Wayback Machine
- Barklan E. , Biham E. , Keller N. Instant ciphertext-only cryptanalysis of GSM encrypted communication . — Journal of cryptology №21-3, 2008.
- Lu Y. , Meier W. , Vaudenay S. Instant ciphertext-only Cryptanalysis of GSM encrypted communication . — Crypto №3621, 2005. (недоступная ссылка)
- Eastlake D. , Schiller J. , Crocker S. Randomness requirements for security . - 2005.
- Harrington B. Get your boost from BIST . — 2008. (недоступная ссылка)
- Дяченко О. Н. Компактный анализ над полем GF(3).
- Варгаузин В. Принципы цифрового телевидения стандарта ATSC. — Журнал Теле-Спутник №9(47), 1999.
Links
- LFSR reference (англ.) . Теория и реализация LFSR, последовательности максимальной длины и полные таблицы отводных последовательностей для длин от 7 до 16 миллионов (от 3 до 24 битов), а также частичные таблицы для длин до 4 миллиардов (от 25 до 32 битов)
- International telecommunications union recommendation O.151 (англ.) . Август 1992
- Pseudo-random number generation routine (англ.)
- [3] (англ.)
- Simple explanation of LFSRs for engineers (англ.)
- Feedback terms (англ.)
- An implementation of a cryptographically secure shrinking pseudorandom number generator (англ.)
- Методы и задачи криптографической защиты информации (недоступная ссылка)