From 16c1011d2af6304c5af53148648feec7ef7a2aa6 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Sat, 7 Jul 2018 18:32:43 +0200 Subject: [PATCH] Improve script --- _posts/2018-07-01-ndh16.md | 4 +++- assets/code/cesar-python2.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/_posts/2018-07-01-ndh16.md b/_posts/2018-07-01-ndh16.md index ea861c4..ada0ea4 100644 --- a/_posts/2018-07-01-ndh16.md +++ b/_posts/2018-07-01-ndh16.md @@ -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 diff --git a/assets/code/cesar-python2.py b/assets/code/cesar-python2.py index fabbef0..e45a02f 100644 --- a/assets/code/cesar-python2.py +++ b/assets/code/cesar-python2.py @@ -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