+ def decrypt_src(encoded, val):
+ ALPHABET = '=/+9876543210zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA'
+ encoded = re.sub(r'[^A-Za-z0-9+/=]', '', encoded)
+ decoded = ''
+ sm = [None] * 4
+ i = 0
+ str_len = len(encoded)
+ while i < str_len:
+ for j in range(4):
+ sm[j % 4] = ALPHABET.index(encoded[i])
+ i += 1
+ char_code = ((sm[0] << 0x2) | (sm[1] >> 0x4)) ^ val
+ decoded += compat_chr(char_code)
+ if sm[2] != 0x40:
+ char_code = ((sm[1] & 0xf) << 0x4) | (sm[2] >> 0x2)
+ decoded += compat_chr(char_code)
+ if sm[3] != 0x40:
+ char_code = ((sm[2] & 0x3) << 0x6) | sm[3]
+ decoded += compat_chr(char_code)
+ return decoded
+