File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535
3636from __future__ import annotations
3737
38- from typing import List
3938
4039
4140def encrypt (plaintext : str , key : int ) -> str :
@@ -77,10 +76,10 @@ def decrypt(ciphertext: str, key: int) -> str:
7776 extra = length % key
7877
7978 # Determine each row length
80- row_lengths : List [int ] = [base + (1 if r < extra else 0 ) for r in range (key )]
79+ row_lengths : list [int ] = [base + (1 if r < extra else 0 ) for r in range (key )]
8180
8281 # Slice ciphertext into rows
83- rows : List [str ] = []
82+ rows : list [str ] = []
8483 idx = 0
8584 for r_len in row_lengths :
8685 rows .append (ciphertext [idx : idx + r_len ])
@@ -90,7 +89,7 @@ def decrypt(ciphertext: str, key: int) -> str:
9089 pointers = [0 ] * key
9190
9291 # Reconstruct by taking characters column-wise across rows
93- result_chars : List [str ] = []
92+ result_chars : list [str ] = []
9493 for i in range (length ):
9594 r = i % key
9695 if pointers [r ] < len (rows [r ]):
You can’t perform that action at this time.
0 commit comments