From b5682c730391b82b03852c2a7d615689a2710774 Mon Sep 17 00:00:00 2001 From: panki27 Date: Mon, 9 Apr 2018 11:04:46 +0200 Subject: [PATCH 1/2] working on resolving 0-width strings --- crypttool.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) mode change 100644 => 100755 crypttool.py diff --git a/crypttool.py b/crypttool.py old mode 100644 new mode 100755 index ea0cd0a..c9d7998 --- a/crypttool.py +++ b/crypttool.py @@ -157,16 +157,18 @@ def resolveZeroWidthString(inputstring): charfound = False binarystring = '' resultstring = '' - inputstring = inputstring.decode('unicode-escape') + #inputstring = inputstring.decode('unicode-escape') + inputstring = inputstring.decode('utf-8') for char in inputstring: - print char if char == u'\u200b': binarystring += '1' elif char == u'\u200d': binarystring += '0' - for byte in binarystring[::8]: - resultstring += translate(byte, 1, 5) - print resultstring + print('Binary:') + print binarystring + #for byte in binarystring[::8]: + # resultstring += translate(byte, 1, 5) + #print resultstring def vignere(plain, key): i = 0 From d97a8858598d6a59df9041087c0fefc5b7b0c652 Mon Sep 17 00:00:00 2001 From: panki27 Date: Mon, 9 Apr 2018 11:16:37 +0200 Subject: [PATCH 2/2] stuff --- crypttool.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crypttool.py b/crypttool.py index c9d7998..af86b5e 100755 --- a/crypttool.py +++ b/crypttool.py @@ -144,9 +144,9 @@ def zeroWidthString(inputstring): binary = translate(inputstring, 5, 1) binaryArray = binary.split(" ") print (binaryArray) - for byte in binaryArray: + for byte in binaryArray[:-1]: for bit in byte[2:10]: - if(bit == '1'): + if(bit == '1'): resultstring+= u'\u200b' #zero-width space else: resultstring+= u'\u200d' #zero-width joiner @@ -157,7 +157,7 @@ def resolveZeroWidthString(inputstring): charfound = False binarystring = '' resultstring = '' - #inputstring = inputstring.decode('unicode-escape') + #inputstring = inputstring.decode('unicode-escape')g inputstring = inputstring.decode('utf-8') for char in inputstring: if char == u'\u200b': @@ -166,9 +166,10 @@ def resolveZeroWidthString(inputstring): binarystring += '0' print('Binary:') print binarystring - #for byte in binarystring[::8]: - # resultstring += translate(byte, 1, 5) - #print resultstring + for byte in binarystring[::8]: + print byte + resultstring += translate(byte, 1, 5) + print resultstring def vignere(plain, key): i = 0