Lfsr-Computer Networks
Lfsr-Computer Networks
sparse LFSRs, are easier to use because you need calculate the XOR of only a few bits.
On the other hand, for cryptographic purposes, you must avoid sparse polynomials
because the resulting algorithms are easy to break. The C program in Listing 1 has the
advantage of implementing the XOR of a 32-bit integer with an efficient algorithm, thus
making an efficient way to implement the software of an LFSR. The program encrypts a
standard input into a standard output one character at a time. You use an LFSR to
generate eight random bits at a time, and the routine XORs the random bits to the
current character. The encryption key is a nonzero integer that you use as the initial
status of the register. The key is the same for both encoding and decoding. The variable
taps represent the 32 binary coefficients of a primitive polynomial of degree 31. Several
other choices are possible; Listing 1 suggests five of them in the comments. You can
safely remove the code that describes the number of characters encrypted and the
running time to make the program even smaller.