Skip to content

Commit fbab82f

Browse files
author
Kristian Rother
committed
add encryption key
1 parent 834bd23 commit fbab82f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

first_steps/indexing.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ area topic
1212
⚙ slice lists and strings
1313
💡 use the ``join`` method of the ``string`` data type
1414
🔀 use a loop variable for indexing
15+
🔀 use indexing to re-arrange a list
1516
======= ====================================
1617

1718

@@ -110,3 +111,25 @@ Exercise 7: Decrypt
110111
-------------------
111112

112113
Write a program to decrypt an encrypted message again.
114+
115+
116+
Exercise 8: Encryption Key
117+
--------------------------
118+
119+
Use an encryption key like ``2031`` that specifies a new order for the blocks.
120+
Implement the following:
121+
122+
1. create an empty list
123+
2. create the blocks as above and add them to the list
124+
3. go through each position of the encryption key
125+
4. select the block with the index given by the digit from the key (convert it to int)
126+
5. add the block to the result string
127+
128+
129+
Reflection questions
130+
--------------------
131+
132+
- what is indexing?
133+
- what do the three numbers in *slicing* do?
134+
- what do you think about the transposition cipher. Is it secure?
135+
- how could you decrypt a transposition cipher without the key?

0 commit comments

Comments
 (0)