@@ -55,6 +55,7 @@ def __neg_pos(self, iterlist: list[int]) -> list[int]:
5555 for i in range (1 , len (iterlist ), 2 ):
5656 iterlist [i ] *= - 1
5757 return iterlist
58+
5859 def __passcode_creator (self ) -> str :
5960 """
6061 Creates a random password from the selection buffer of
@@ -67,7 +68,7 @@ def __passcode_creator(self) -> str:
6768 """
6869 choices = string .ascii_letters + string .digits
6970 password = [random .choice (choices ) for _ in range (random .randint (10 , 20 ))]
70- return '' .join (password )
71+ return "" .join (password )
7172
7273 def __make_key_list (self ) -> list [str ]:
7374 """
@@ -139,9 +140,7 @@ def decrypt(self, encoded_message: str) -> str:
139140 # reverse shift or left shift
140141 for char in encoded_message :
141142 position = self .__key_list .index (char )
142- decoded_message += self .__key_list [
143- (position - self .__shift_key ) % key_len
144- ]
143+ decoded_message += self .__key_list [(position - self .__shift_key ) % key_len ]
145144
146145 return decoded_message
147146
@@ -162,9 +161,7 @@ def encrypt(self, plaintext: str) -> str:
162161 # forward shift or right shift
163162 for char in plaintext :
164163 position = self .__key_list .index (char )
165- encoded_message += self .__key_list [
166- (position + self .__shift_key ) % key_len
167- ]
164+ encoded_message += self .__key_list [(position + self .__shift_key ) % key_len ]
168165
169166 return encoded_message
170167
0 commit comments