update writeup
This commit is contained in:
@@ -43,11 +43,11 @@ def get_factors(ct:bytes, n:int=256) -> (int, int):
|
|||||||
- When the factors are found, simply create a lookup table of all values and substitute each byte in the ciphertext.
|
- When the factors are found, simply create a lookup table of all values and substitute each byte in the ciphertext.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def decrypt(ct:bytes) -> bytes:
|
def decrypt(ct:bytes, lut:dict) -> bytes:
|
||||||
''' decrypt the file using the lookup table '''
|
''' decrypt the file using the lookup table '''
|
||||||
res = b''
|
res = b''
|
||||||
for byte in ct:
|
for byte in ct:
|
||||||
dec = lookup[byte]
|
dec = lut[byte]
|
||||||
res += bytes([dec])
|
res += bytes([dec])
|
||||||
return res
|
return res
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user