From 4fda56d33b9a0c138156782517a606a8fbf70afc Mon Sep 17 00:00:00 2001 From: panki27 Date: Tue, 24 Oct 2017 11:16:01 +0200 Subject: [PATCH] Better B64 regex, shoutout to ~ASM --- crypttool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypttool.py b/crypttool.py index b755db4..2d1ab4c 100644 --- a/crypttool.py +++ b/crypttool.py @@ -61,7 +61,7 @@ def translate(inputString, inputType, outputType): result = chr(inputString) return result def base64prompt(): - b64regex = '\S*=$' + b64regex = '^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$' inputString = raw_input('Please input your string: ') match = re.match(b64regex, inputString) if (match):