GO-V.ORG
As seen in

Linear-feedback shift register

In computing, a linear-feedback shift register (LFSR) is a shift register whose input bit is a linear function of its previous state.[6] The most commonly used linear function of single bits is exclusive-or (XOR).[src] Thus, an LFSR is most often a shift register whose input bit is driven by the XOR of some bits of the overall shift register value.[12] The initial value of the LFSR is called the seed, and because the operation of the register is deterministic, the stream of values produced by the register is completely determined by its current (or previous) state.[src] Likewise, because the register has a finite number of possible states, it must eventually enter a repeating cycle.[src] However, an LFSR with a well-chosen feedback function can produce a sequence of bits that appears random and has a very long cycle.[12] Applications of LFSRs include generating pseudo-random numbers, pseudo-noise sequences, fast digital counters, and whitening sequences.[12] Both hardware and software implementations of LFSRs are common.[src] The mathematics of a cyclic redundancy check, used to provide a quick check against transmission errors, are closely related to those of an LFSR.[1] In general, the arithmetics behind LFSRs makes them very elegant as an object to study and implement.[src] One can produce relatively complex logics with simple building blocks.…[src]

In computing, a linear-feedback shift register (LFSR) is a shift register whose input bit is a linear function of its previous state.[6] The most commonly used linear function of single bits is exclusive-or (XOR).[src] Thus, an LFSR is most often a shift register whose input bit is driven by the XOR of some bits of the overall shift register value.[12] The initial value of the LFSR is called the seed, and because the operation of the register is deterministic, the stream of values produced by the register is completely determined by its current (or previous) state.[src] Likewise, because the register has a finite number of possible states, it must eventually enter a repeating cycle.[src] However, an LFSR with a well-chosen feedback function can produce a sequence of bits that appears random and has a very long cycle.[12] Applications of LFSRs include generating pseudo-random numbers, pseudo-noise sequences, fast digital counters, and whitening sequences.[12] Both hardware and software implementations of LFSRs are common.[src] The mathematics of a cyclic redundancy check, used to provide a quick check against transmission errors, are closely related to those of an LFSR.[1] In general, the arithmetics behind LFSRs makes them very elegant as an object to study and implement.[src] One can produce relatively complex logics with simple building blocks.[src] However, other methods, that are less elegant but perform better, should be considered as well.[src] There can be more than one maximum-length tap sequence for a given LFSR length.[13] Also, once one maximum-length tap sequence has been found, another automatically follows.[src] If the tap sequence in an n-bit LFSR is , where the 0 corresponds to the x 0  = 1 term, then the corresponding "mirror" sequence is .[12] So the tap sequence has as its counterpart .[src] Both give a maximum-length sequence.[src] An example in C is below: include unsigned lfsr_fib(void) { uint16_t start_state = 0xACE1u; /* Any nonzero start state will work.[src] */ uint16_t lfsr = start_state; uint16_t bit; /* Must be 16-bit to allow bit > 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 5)) & 1u; lfsr = (lfsr >> 1) | (bit If a fast parity or popcount operation is available, the feedback bit can be computed more efficiently as the dot product of the register with the characteristic polynomial: bit = parity(lfsr & 0x002Du); , or equivalently bit = popcnt(lfsr & 0x002Du) /* & 1u */; .[13] (The & 1u turns the popcnt into a true parity function, but the bitshift later bit makes higher bits irrelevant.) If a rotation operation is available, the new state can be computed as lfsr = rotateright((lfsr & ~1u) | (bit & 1u), 1); , or equivalently lfsr = rotateright(((bit ^ lfsr) & 1u) ^ lfsr, 1); This LFSR configuration is also known as standard, many-to-one or external XOR gates.[13] The alternative Galois configuration is described in the next section.[src] start_state = 1 > 1) ^ (lfsr >> 3) ^ (lfsr >> 12)) & 1 lfsr = (lfsr >> 1) | (bit Where a register of 16 bits is used and the xor tap at the fourth, 13th, 15th and sixteenth bit establishes a maximum sequence length.[12] include unsigned lfsr_galois(void) { uint16_t start_state = 0xACE1u; /* Any nonzero start state will work.[src] */ uint16_t lfsr = start_state; unsigned period = 0; do { ifndef LEFT unsigned lsb = lfsr & 1u; /* Get LSB (i.e., the output bit).[src] */ lfsr >>= 1; /* Shift register */ if (lsb) /* If the output bit is 1, */ lfsr ^= 0xB400u; /* apply toggle mask.[12] */ else unsigned msb = (int16_t) lfsr The branch if (lsb) lfsr ^= 0xB400u; can also be written as lfsr ^= (-lsb) & 0xB400u; which may produce more efficient code on some compilers.[13] In addition, the left-shifting variant may produce even better code, as the msb is the carry from the addition of lfsr to itself (equivalent to, and often generated from, the left shift).[12] include uint64_t prsg63(uint64_t lfsr) { lfsr = lfsr > 32; lfsr = lfsr > 32; return lfsr; } Binary Galois LFSRs like the ones shown above can be generalized to any q-ary alphabet {0, 1, ..., q − 1} (e.g., for binary, q = 2, and the alphabet is simply {0, 1}).[13] In this case, the exclusive-or component is generalized to addition modulo-q (note that XOR is addition modulo 2), and the feedback bit (output bit) is multiplied (modulo-q) by a q-ary value, which is constant for each specific tap point.[src] Note that this is also a generalization of the binary case, where the feedback is multiplied by either 0 (no feedback, i.e., no tap) or 1 (feedback is present).[13] Given an appropriate tap configuration, such LFSRs can be used to generate Galois fields for arbitrary prime values of q.[src] include unsigned lfsr_xorshift(void) { uint16_t start_state = 0xACE1u; /* Any nonzero start state will work.[src] */ uint16_t lfsr = start_state; unsigned period = 0; do { // 7,9,13 triplet from http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html lfsr ^= lfsr >> 7; lfsr ^= lfsr > 13; ++period; } while (lfsr != start_state); return period; } \begin{pmatrix} a_{k} \\ a_{k+1} \\ a_{k+2} \\ \vdots \\ a_{k+n-1} \end{pmatrix} = \begin{pmatrix} 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \ddots & \vdots \\ \vdots & \vdots & \ddots & \ddots & 0\\ 0 & 0 & \cdots & 0& 1\\ c_{0} & c_{1} & \cdots & \cdots & c_{n-1} \end{pmatrix} \begin{pmatrix} a_{k-1} \\ a_{k} \\ a_{k+1} \\ \vdots \\ a_{k+n-2} \end{pmatrix} = \begin{pmatrix} 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \ddots & \vdots \\ \vdots & \vdots & \ddots & \ddots & 0\\ 0 & 0 & \cdots & 0& 1\\ c_{0} & c_{1} & \cdots & \cdots & c_{n-1} \end{pmatrix}^k \begin{pmatrix} a_0 \\ a_1 \\ a_2 \\ \vdots \\ a_{n-1} \end{pmatrix} Matrix for the corresponding Galois form is : \begin{pmatrix} c_{n-1} & 1 & 0 & \cdots & 0 \\ c_{n-2} & 0 & 1 & \ddots & \vdots \\ \vdots & \vdots & \ddots & \ddots & 0\\ c_1 & 0 & \cdots & 0& 1\\ c_0 & 0 & \cdots & \cdots & 0 \end{pmatrix} For a suitable initialisation, a'_i=\sum_{j=0}^ia_{i-j}c_{i},\ 0\leq i the top coefficient of the column vector : \begin{pmatrix} c_{n-1} & 1 & 0 & \cdots & 0 \\ c_{n-2} & 0 & 1 & \ddots & \vdots \\ \vdots & \vdots & \ddots & \ddots & 0\\ c_1 & 0 & \cdots & 0& 1\\ c_0 & 0 & \cdots & \cdots & 0 \end{pmatrix}^k \begin{pmatrix} a'_0 \\ a'_1 \\ a'_2 \\ \vdots \\ a'_{n-1} \end{pmatrix} gives the term of the original sequence.[10] These forms generalize naturally to arbitrary fields.[src] Maximal Length LFSR table with length from 2 to 67.[src] Pseudo-Random Number Generation Routine for the MAX765x Microprocessor https://www.ece.ualberta.ca/~elliott/ee552/studentAppNotes/1999f/Drivers_Ed/lfsr.html http://www.quadibloc.com/crypto/co040801.htm Simple explanation of LFSRs for Engineers Feedback terms General LFSR Theory An implementation of LFSR in VHDL.[6] Simple VHDL coding for Galois and Fibonacci LFSR.[src] mlpolygen: A Maximal Length polynomial generator LFSR and Intrinsic Generation of Randomness: Notes From NKS[4]

49 sentences · 49 cited inline · 13 references stored

References

  1. Cyclic Redundancy Check Computation: An Implementation Using the TMS320C54x . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Cyclic Redundancy Check Computation: An Implementation Using the TMS320C54x ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Cyclic Redundancy Check Computation: An Implementation Using the TMS320C54x ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA encyclopegia.org. (2026). Cyclic Redundancy Check Computation: An Implementation Using the TMS320C54x . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  2. Instant Ciphertext-Only Cryptanalysis of GSM Encrypted Communication . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Instant Ciphertext-Only Cryptanalysis of GSM Encrypted Communication ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Instant Ciphertext-Only Cryptanalysis of GSM Encrypted Communication ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA encyclopegia.org. (2026). Instant Ciphertext-Only Cryptanalysis of GSM Encrypted Communication . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  3. Lu, Yi. Advances in Cryptology – CRYPTO 2005 . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Lu, Yi. Advances in Cryptology – CRYPTO 2005 ." Lu, Yi. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Lu, Yi. Advances in Cryptology – CRYPTO 2005 ." Lu, Yi. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Lu, Yi. (2026). Lu, Yi. Advances in Cryptology – CRYPTO 2005 . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  4. Martínez LH, Khursheed S, Reddy SM. LFSR generation for high test coverage and low hardware overhead. IET Computers & Digital Techniques. 2019 Aug 21.[https://livrepository.liverpool.ac.uk/3052312/ Uo . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Martínez LH, Khursheed S, Reddy SM. LFSR generation for high test coverage and low hardware overhead. IET Computers & Digital Techniques. 2019 Aug 21.[https://livrepository.liverpool.ac.uk/3052312/ Uo ." Martínez LH, Khursheed S, Reddy SM. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Martínez LH, Khursheed S, Reddy SM. LFSR generation for high test coverage and low hardware overhead. IET Computers & Digital Techniques. 2019 Aug 21.[https://livrepository.liverpool.ac.uk/3052312/ Uo ." Martínez LH, Khursheed S, Reddy SM. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Martínez LH, Khursheed S, Reddy SM. (2026). Martínez LH, Khursheed S, Reddy SM. LFSR generation for high test coverage and low hardware overhead. IET Computers & Digital Techniques. 2019 Aug 21.[https://livrepository.liverpool.ac.uk/3052312/ Uo . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  5. Time dissemination via the LF transmitter . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Time dissemination via the LF transmitter ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Time dissemination via the LF transmitter ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA encyclopegia.org. (2026). Time dissemination via the LF transmitter . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  6. [http://www.xilinx.com/support/documentation/application_notes/xapp210.pdf Linear Feedback Shift Registers in Virtex Devices] . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "[http://www.xilinx.com/support/documentation/application_notes/xapp210.pdf Linear Feedback Shift Registers in Virtex Devices] ." http://www. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "[http://www.xilinx.com/support/documentation/application_notes/xapp210.pdf Linear Feedback Shift Registers in Virtex Devices] ." http://www. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA http://www. (2026). [http://www.xilinx.com/support/documentation/application_notes/xapp210.pdf Linear Feedback Shift Registers in Virtex Devices] . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  7. Random Numbers Generated by Linear Recurrence Modulo Two . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Random Numbers Generated by Linear Recurrence Modulo Two ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Random Numbers Generated by Linear Recurrence Modulo Two ." 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA encyclopegia.org. (2026). Random Numbers Generated by Linear Recurrence Modulo Two . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  8. Marsaglia, George. Xorshift RNGs . July 2003. · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Marsaglia, George. Xorshift RNGs . July 2003." Marsaglia, George. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Marsaglia, George. Xorshift RNGs . July 2003." Marsaglia, George. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Marsaglia, George. (2026). Marsaglia, George. Xorshift RNGs . July 2003. Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  9. Brent, Richard P. Note on Marsaglia's Xorshift Random Number Generators . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Brent, Richard P. Note on Marsaglia's Xorshift Random Number Generators ." Brent, Richard P. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Brent, Richard P. Note on Marsaglia's Xorshift Random Number Generators ." Brent, Richard P. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Brent, Richard P. (2026). Brent, Richard P. Note on Marsaglia's Xorshift Random Number Generators . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  10. Metcalf, John. 16-Bit Xorshift Pseudorandom Numbers in Z80 Assembly . Retro . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Metcalf, John. 16-Bit Xorshift Pseudorandom Numbers in Z80 Assembly . Retro ." Metcalf, John. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Metcalf, John. 16-Bit Xorshift Pseudorandom Numbers in Z80 Assembly . Retro ." Metcalf, John. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Metcalf, John. (2026). Metcalf, John. 16-Bit Xorshift Pseudorandom Numbers in Z80 Assembly . Retro . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  11. Weisstein, Eric W. Primitive Polynomial . mathworld.wolfram.com . retrieved 2021-04-27 · retrieved 2021-04-26 · rev 1375542776
    Cite this reference

    MLA "Weisstein, Eric W. Primitive Polynomial . mathworld.wolfram.com . retrieved 2021-04-27." Weisstein, Eric W. 2021-04-26. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Weisstein, Eric W. Primitive Polynomial . mathworld.wolfram.com . retrieved 2021-04-27." Weisstein, Eric W. 2021-04-26. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Weisstein, Eric W. (2021). Weisstein, Eric W. Primitive Polynomial . mathworld.wolfram.com . retrieved 2021-04-27. Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  12. Alf, Peter. Efficient Shift Registers, LFSR Counters, and Long Pseudo-Random Sequence Generators . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "Alf, Peter. Efficient Shift Registers, LFSR Counters, and Long Pseudo-Random Sequence Generators ." Alf, Peter. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "Alf, Peter. Efficient Shift Registers, LFSR Counters, and Long Pseudo-Random Sequence Generators ." Alf, Peter. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA Alf, Peter. (2026). Alf, Peter. Efficient Shift Registers, LFSR Counters, and Long Pseudo-Random Sequence Generators . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

  13. LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and therefore can operate at higher clock rates. However, it is necessary to ens . · retrieved 2026-09-17 · rev 1375542776
    Cite this reference

    MLA "LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and therefore can operate at higher clock rates. However, it is necessary to ens ." LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and ther. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776. Accessed 02 December 2026.

    Chicago "LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and therefore can operate at higher clock rates. However, it is necessary to ens ." LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and ther. 2026-09-17. https://en.wikipedia.org/w/index.php?oldid=1375542776.

    APA LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and ther. (2026). LFSR Counter (digital)|counters have simpler feedback logic than natural binary counters or Gray-code counters, and therefore can operate at higher clock rates. However, it is necessary to ens . Retrieved December 2, 2026, from https://en.wikipedia.org/w/index.php?oldid=1375542776

Cite this article

MLA

"Linear-feedback shift register." encyclopegia.org, 2026, https://encyclopegia.org/wiki/linear-feedback-shift-register. Accessed 02 December 2026.

Chicago

"Linear-feedback shift register." encyclopegia.org. Accessed December 2, 2026. https://encyclopegia.org/wiki/linear-feedback-shift-register.

APA

encyclopegia.org. (2026). Linear-feedback shift register. Retrieved December 2, 2026, from https://encyclopegia.org/wiki/linear-feedback-shift-register

Accessed December 2, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1375542776 · 0.5 · snapshot enwiki-001375542776

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.