def _unsalt_cipher_token(token):
 salt = token[:CSRF_SECRET_LENGTH]
 token = token[CSRF_SECRET_LENGTH:]
 chars = CSRF_ALLOWED_CHARS
 pairs = zip((chars.index(x) for x in token), (chars.index(x) for x in salt))
 secret = ''.join((chars[(x - y)] for (x, y) in pairs))
 return secret

def _unsalt_cipher_token ( token ) : salt = token [ : CSRF_SECRET_LENGTH ] token = token [ CSRF_SECRET_LENGTH : ] chars = CSRF_ALLOWED_CHARS pairs = zip ( ( chars . index ( x ) for x in token ) , ( chars . index ( x ) for x in salt ) ) secret = '' . join ( ( chars [ ( x - y ) ] for ( x , y ) in pairs ) ) return secret
given a token .