update readme

This commit is contained in:
aaron
2021-12-04 04:48:22 +01:00
parent 5d93a845ce
commit e8e8d7c865

View File

@@ -24,7 +24,7 @@ HTB{4ff1n3_c1ph3r_15_51mpl3_m47h5}
- So it's possible to attack the encryption by iterating and trying to create a pair (a, b) that matches the entire encrypted pdf header.
```python
def get_factors(ct, n=256):
def get_factors(ct:bytes, n:int=256) -> (int, int):
''' find a and b for n and ct '''
# first generate a list of all numbers without common divisor with 256
nogcds = [ x for x in range(1, n) if gcd(x, n) == 1 ]
@@ -43,7 +43,7 @@ def get_factors(ct, n=256):
- When the factors are found, simply create a lookup table of all values and substitute each byte in the ciphertext.
```python
def decrypt(ct):
def decrypt(ct:bytes) -> bytes:
''' decrypt the file using the lookup table '''
res = b''
for byte in ct: