

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: Stream Ciphers
incomplete
2: Stream Ciphers
incomplete
3: State Ciphers
incomplete
4: State Ciphers
incomplete
This lesson's interactive features are locked, please to keep using them
Stream ciphers are also referred to as "state ciphers" because the encryption and decryption of each character depends on the current state of the cipher.
"Current state" just means the "current progress", that is, how many bytes we've already encrypted or decrypted so far.
For example, let's take the following data for a one-time pad cipher:
plaintext = "010011"
key = "101001"
When the "state" of the cipher is at index 0, we will only have encrypted the first digit:
plaintext = "010011"
key = "101001"
state = index 0
result = "1"
state = index 1
result = "11"
state = index 2
result = "111"
state = index 3
result = "1110"
state = index 4
result = "11101"
state = index 5
result = "111010"
We've been asked to update our code to print the progress of the cipher as it encrypts and decrypts each character. There have been some very large encryption tasks, and people are getting confused when the cipher doesn't seem to be doing anything for a while.
Update the crypt function. It should print this message after each character is sent to the result channel:
Crypted byte: NUM
Where NUM is the number of bytes that have been encrypted so far, starting at 1.