Feedback with Carry Shift Registers

From HandWiki

In sequence design, a Feedback with Carry Shift Register (or FCSR) is the arithmetic or with carry analog of a linear-feedback shift register (LFSR). If [math]\displaystyle{ N \gt 1 }[/math] is an integer, then an N-ary FCSR of length [math]\displaystyle{ r }[/math] is a finite state device with a state [math]\displaystyle{ (a;z) = (a_0,a_1,\dots,a_{r-1};z) }[/math] consisting of a vector of elements [math]\displaystyle{ a_i }[/math] in [math]\displaystyle{ \{0,1,\dots,N-1\}=S }[/math] and an integer [math]\displaystyle{ z }[/math].[1][2][3][4] The state change operation is determined by a set of coefficients [math]\displaystyle{ q_1,\dots,q_n }[/math] and is defined as follows: compute [math]\displaystyle{ s = q_r a_0+q_{r-1} a_1+\dots+q_1 a_{r-1} + z }[/math]. Express s as [math]\displaystyle{ s = a_r + N z' }[/math] with [math]\displaystyle{ a_r }[/math] in [math]\displaystyle{ S }[/math]. Then the new state is [math]\displaystyle{ (a_1,a_2,\dots,a_r; z') }[/math]. By iterating the state change an FCSR generates an infinite, eventually periodic sequence of numbers in [math]\displaystyle{ S }[/math].

FCSRs have been used in the design of stream ciphers (such as the F-FCSR generator), in the cryptanalysis of the summation combiner stream cipher (the reason Goresky and Klapper invented them[1]), and in generating pseudorandom numbers for quasi-Monte Carlo (under the name Multiply With Carry (MWC) generator - invented by Couture and L'Ecuyer,[2]) generalizing work of Marsaglia and Zaman.[5]

FCSRs are analyzed using number theory. Associated with the FCSR is a connection integer [math]\displaystyle{ q = q_r N^r + \dots + q_1 N^1 - 1 }[/math]. Associated with the output sequence is the N-adic number [math]\displaystyle{ a = a_0 + a_1 N + a_2N^2+\dots }[/math] The fundamental theorem of FCSRs says that there is an integer [math]\displaystyle{ u }[/math] so that [math]\displaystyle{ a = u/q }[/math], a rational number. The output sequence is strictly periodic if and only if [math]\displaystyle{ u }[/math] is between [math]\displaystyle{ -q }[/math] and [math]\displaystyle{ 0 }[/math]. It is possible to express u as a simple quadratic polynomial involving the initial state and the qi.[1]

There is also an exponential representation of FCSRs: if [math]\displaystyle{ g }[/math] is the inverse of [math]\displaystyle{ N \pmod q }[/math], and the output sequence is strictly periodic, then [math]\displaystyle{ a_i = (A g_i \bmod q) \bmod N }[/math], where [math]\displaystyle{ A }[/math] is an integer. It follows that the period is at most the order of N in the multiplicative group of units modulo q. This is maximized when q is prime and N is a primitive element modulo q. In this case, the period is [math]\displaystyle{ q-1 }[/math]. In this case the output sequence is called an l-sequence (for "long sequence").[1]

l-sequences have many excellent statistical properties[1][3] that make them candidates for use in applications,[6] including near uniform distribution of sub-blocks, ideal arithmetic autocorrelations, and the arithmetic shift and add property. They are the with-carry analog of m-sequences or maximum length sequences.

There are efficient algorithms for FCSR synthesis. This is the problem: given a prefix of a sequence, construct a minimal length FCSR that outputs the sequence. This can be solved with a variant of Mahler[7] and De Weger's[8] lattice based analysis of N-adic numbers when [math]\displaystyle{ N=2 }[/math];[1] by a variant of the Euclidean algorithm when N is prime; and in general by Xu's adaptation of the Berlekamp-Massey algorithm.[9] If L is the size of the smallest FCSR that outputs the sequence (called the N-adic complexity of the sequence), then all these algorithms require a prefix of length about [math]\displaystyle{ 2L }[/math] to be successful and have quadratic time complexity. It follows that, as with LFSRs and linear complexity, any stream cipher whose N-adic complexity is low should not be used for cryptography.

FCSRs and LFSRs are special cases of a very general algebraic construction of sequence generators called Algebraic Feedback Shift Registers (AFSRs) in which the integers are replaced by an arbitrary ring R and N is replaced by an arbitrary non-unit in R.[10] A general reference on the subject of LFSRs, FCSRs, and AFSRs is the book.[4]

References

  1. 1.0 1.1 1.2 1.3 1.4 1.5 Klapper, Andrew; Goresky, Mark (March 1997). "Feedback Shift Registers, 2-Adic Span, and Combiners With Memory". Journal of Cryptology 10 (2): 111–147. doi:10.1007/s001459900024. http://cs.engr.uky.edu/~klapper/pdf/fcsr.pdf. 
  2. 2.0 2.1 Couture, Raymond; L’Ecuyer, Pierre (April 1994). "On the lattice structure of certain linear congruential sequences related to AWC/SWB generators". Mathematics of Computation 62 (206): 799–808. doi:10.2307/2153540. https://www.ams.org/journals/mcom/1994-62-206/S0025-5718-1994-1220826-X/S0025-5718-1994-1220826-X.pdf. 
  3. 3.0 3.1 Goresky, Mark; Klapper, Andrew (October 2003). "Efficient Multiply-with-Carry Random Number Generators with Maximal Period". ACM Transactions on Modeling and Computer Simulation 13 (4): 310–321. doi:10.1145/945511.945514. https://www.math.ias.edu/~goresky/pdf/p1-goresky.pdf. 
  4. 4.0 4.1 Goresky, Mark; Klapper, Andrew (2012). Algebraic Shift Register Sequences. Cambridge University Press. ISBN 978-1-107-01499-2.  Table of contents.
  5. "A new class of random number generators" (pdf). Annals of Applied Probability 1 (3): 462–480. August 1991. doi:10.1214/aoap/1177005878. https://projecteuclid.org/download/pdf_1/euclid.aoap/1177005878. 
  6. Applied Cryptography. New York: John Wiley & Sons. 1996. https://archive.org/details/Applied_Cryptography_2nd_ed._B._Schneier. 
  7. "On a geometrical representation of p-adic numbers". Annals of Mathematics. 2 41 (1): 8–56. January 1940. doi:10.2307/1968818. https://carma.newcastle.edu.au/mahler/docs/064.pdf#. 
  8. de Weger, B. M. M. (September 1986). [1dW-ApprLatt-JNumTh[1986].pdf "Approximation lattices of p–adic numbers"]. Journal of Number Theory 24 (1): 70–88. doi:10.1016/0022-314X(86)90059-4. http://deweger.xs4all.nl/papers/[1]dW-ApprLatt-JNumTh[1986].pdf. 
  9. Klapper, Andrew; Xu, Jinzhong (March 2004). "Register Synthesis for Algebraic Feedback Shift Registers Based on Non-Primes". Designs, Codes and Cryptography 31 (3): 227–250. doi:10.1023/B:DESI.0000015886.71135.e1. http://cs.engr.uky.edu/~klapper/pdf/nfcsr.pdf. 
  10. Klapper, Andrew; Xu, Jinzhong (17 September 1999). "Algebraic Feedback Shift Registers". Theoretical Computer Science 226 (1–2): 61–93. doi:10.1016/S0304-3975(99)00066-3. https://www.cs.uky.edu/~klapper/pdf/afsr.pdf.