Skip to content

Instantly share code, notes, and snippets.

@anantshri
Created April 15, 2015 11:57
Show Gist options
  • Save anantshri/bcb9caecc7ec76c3b42d to your computer and use it in GitHub Desktop.
Save anantshri/bcb9caecc7ec76c3b42d to your computer and use it in GitHub Desktop.
remove all = from a probable base64 string but preserve the last 1 or 2
str1="ssdggagad=gadg=adg=dasgadsg=as=gads=gas=as=asgas214=12rf=sdvgewt23g=vew=g4=="
x=str1[len(str1) - 2:]
if x == "==":
print str1.replace("=","") + x
else:
print str1.replace("=","") + "="
str2="ssdggagad=gadg=adg=dasgadsg=as=gads=gas=as=asgas214=12rf=sdvgewt23g=vew=g4="
x=str2[len(str2) - 2:]
if x == "==":
print str2.replace("=","") + x
else:
print str2.replace("=","") + "="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment