From the course: Symmetric Cryptography Essential Training
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Solution: Software-based LFSR
From the course: Symmetric Cryptography Essential Training
Solution: Software-based LFSR
(bright electronic music) - [Instructor] Let's take a look at what a software-based LFSR might look like. I declare an extra variable called newBit that I'll be using to calculate the value that goes into the leftmost bit of the LFSR. We have the meat of the program in this for loop, which runs 35 times. I start by printing the last position in the array for the value that falls out, followed by space, then I calculate the new bit, which is just the sequence of XOR as I described before. Then we shift all the bits to the right, and finally, we update the first bit with the new bit value we calculated earlier. It wasn't necessary to do this, but I'm also printing out the state of the LFSR if it were to keep generating output. Let's run it and see if you got the same output as I did. How'd you do? Hopefully yours matches. If it doesn't, go back and check your logic. Otherwise, congratulations. Let's move on.
Contents
-
-
-
-
-
Simple substitution ciphers4m 48s
-
(Locked)
Polyalphabetic substitution ciphers6m 28s
-
(Locked)
Permutation and transposition ciphers2m 50s
-
(Locked)
Simple one-time pads with XOR3m 6s
-
(Locked)
S-boxes and P-boxes1m 49s
-
(Locked)
Feistel networks2m 30s
-
(Locked)
Linear-feedback shift registers (LFSRs)2m 42s
-
(Locked)
Challenge: Software-based LFSR1m 15s
-
(Locked)
Solution: Software-based LFSR56s
-
-
-
-
-