Skip to content

Instantly share code, notes, and snippets.

@sandromello
Created September 25, 2012 16:43
Show Gist options
  • Save sandromello/3783046 to your computer and use it in GitHub Desktop.
Save sandromello/3783046 to your computer and use it in GitHub Desktop.
Decode base64 string python
import base64
# Picture a scenario where you need to retrieve a base64 string and decrypt with a privatekey
base64str = 'E6ne2WavwjIBh3wmUtc1xQRhW9eSK4T5fNkP+GSpaUboKqiI0degfQ=='
decodedstr = base64.b64decode(base64str)
# Now you can decrypt it
decrypted = unpad(cipher.decrypt(decodestr))
# Decrypted string
print decrypted
@Harsha-IAGB
Copy link

unpad is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment