Improve script

This commit is contained in:
Quentin 2018-07-07 18:32:43 +02:00
parent f30fe87c19
commit 16c1011d2a
2 changed files with 5 additions and 1 deletions

View File

@ -38,13 +38,15 @@ On avait donc :
decode = (encode + 75) % 128
```
Et voici un script python 3 simple pour réaliser toutes les étapes :
Et voici un script python 3 simple pour réaliser toutes les étapes (appuyez sur entrée pour essayer une nouvelle valeur de n) :
```python
with open('communication_vBZvcbm.txt', 'rb') as f:
all_bytes = f.readlines()
all_bytes = all_bytes[0] + all_bytes[1]
for n in range(1,128):
print("\033c")
print("==== try number " + str(n) + "==== \n\n")
dec = [0] * len(all_bytes)
for i in range(len(all_bytes)):
dec[i] = (all_bytes[i] + n) % 128

View File

@ -2,6 +2,8 @@ with open('communication_vBZvcbm.txt', 'rb') as f:
all_bytes = f.readlines()
all_bytes = all_bytes[0] + all_bytes[1]
for n in range(1,128):
print "\033c"
print "==== try number " + str(n) + "==== \n\n"
dec = [0] * len(all_bytes)
for i in range(len(all_bytes)):
dec[i] = (ord(all_bytes[i]) + n) % 128