File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
- def running_key_encrypt (key , plaintext ):
1
+ def running_key_encrypt (key : str , plaintext : str ) -> str :
2
+ """
3
+ Encrypts the plaintext using the Running Key Cipher.
4
+
5
+ :param key: The running key (long piece of text).
6
+ :param plaintext: The plaintext to be encrypted.
7
+ :return: The ciphertext.
8
+ """
2
9
plaintext = plaintext .replace (" " , "" ).upper ()
3
10
key = key .replace (" " , "" ).upper ()
4
11
key_length = len (key )
@@ -13,7 +20,14 @@ def running_key_encrypt(key, plaintext):
13
20
return "" .join (ciphertext )
14
21
15
22
16
- def running_key_decrypt (key , ciphertext ):
23
+ def running_key_decrypt (key : str , ciphertext : str ) -> str :
24
+ """
25
+ Decrypts the ciphertext using the Running Key Cipher.
26
+
27
+ :param key: The running key (long piece of text).
28
+ :param ciphertext: The ciphertext to be decrypted.
29
+ :return: The plaintext.
30
+ """
17
31
ciphertext = ciphertext .replace (" " , "" ).upper ()
18
32
key = key .replace (" " , "" ).upper ()
19
33
key_length = len (key )
You can’t perform that action at this time.
0 commit comments