This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import hashlib | |
import hmac | |
import simplejson as json | |
def base64_url_decode(inp): | |
padding_factor = (4 - len(inp) % 4) % 4 | |
inp += "="*padding_factor | |
return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/')))) |