diff --git a/src/Encoding/Solve.hs b/src/Encoding/Solve.hs index bbdc4bd..e2fe6ad 100644 --- a/src/Encoding/Solve.hs +++ b/src/Encoding/Solve.hs @@ -28,9 +28,9 @@ base64Regex = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$" base58Regex = "^[1-9A-HJ-NP-Za-km-z]+$" -- incorrect base32Regex = "^(?:[A-Z2-7]{8})*(?:[A-Z2-7]{2}={6}|[A-Z2-7]{4}={4}|[A-Z2-7]{5}={3}|[A-Z2-7]{7}=)?$" base16Regex = "^[0-9A-FXx]*$" -base10Regex = "^[0-9]*$" -base8Regex = "^[0-7]*$" -base2Regex = "^[01]*$" +base10Regex = "^[0-9 ]*$" +base8Regex = "^[0-7 ]*$" +base2Regex = "^[01 ]*$" urlRegex = "^[a-zA-Z0-9%]*$" solveEnc :: BC.ByteString -> BC.ByteString @@ -45,14 +45,14 @@ solveEnc input = isBase8 = input =~ base8Regex :: Bool isBase2 = input =~ base2Regex :: Bool isURL = input =~ urlRegex :: Bool - base91Result = if isBase91 then BC.pack "\nTrying base91:\n" `BC.append` dec91 input else BC.empty - base85Result = if isBase85 then BC.pack "\nTrying base85:\n" `BC.append` dec85 input else BC.empty - base64Result = if isBase64 then BC.pack "\nTrying base64:\n" `BC.append` dec64 input else BC.empty - base58Result = if isBase58 then BC.pack "\nTrying base58:\n" `BC.append` dec58 input else BC.empty - base32Result = if isBase64 then BC.pack "\nTrying base32:\n" `BC.append` dec32 input else BC.empty - base16Result = if isBase16 then BC.pack "\nTrying base16:\n" `BC.append` dec16 input else BC.empty - base10Result = if isBase10 then BC.pack "\nTrying base10:\n" `BC.append` dec10 input else BC.empty - base2Result = if isBase2 then BC.pack "\nTrying base2:\n" `BC.append` dec2 input else BC.empty - base8Result = if isBase8 then BC.pack "\nTrying base8:\n" `BC.append` dec8 input else BC.empty + base91Result = if isBase91 then BC.pack "\nBase91:\n" `BC.append` dec91 input else BC.empty + base85Result = if isBase85 then BC.pack "\nBase85:\n" `BC.append` dec85 input else BC.empty + base64Result = if isBase64 then BC.pack "\nBase64:\n" `BC.append` dec64 input else BC.empty + base58Result = if isBase58 then BC.pack "\nBase58:\n" `BC.append` dec58 input else BC.empty + base32Result = if isBase64 then BC.pack "\nBase32:\n" `BC.append` dec32 input else BC.empty + base16Result = if isBase16 then BC.pack "\nBase16:\n" `BC.append` dec16 input else BC.empty + base10Result = if isBase10 then BC.pack "\nBase10:\n" `BC.append` dec10 input else BC.empty + base2Result = if isBase2 then BC.pack "\nBase2:\n" `BC.append` dec2 input else BC.empty + base8Result = if isBase8 then BC.pack "\nBase8:\n" `BC.append` dec8 input else BC.empty urlResult = if isURL then BC.pack "\nTrying URL decode:\n" `BC.append` decurl input else BC.empty in BC.concat [base91Result, base85Result, base64Result, base58Result, base32Result, base16Result, base10Result, base8Result, base2Result, urlResult]