Hello, this library can be used to encrypt/decrypt GET request data for the GTS.
Usage:

Decoding: decode_data('base64datahere')
Example: decode_data('SjssYIjyfd2vGH2HWtK70g==')

Encoding: encode_data('hexdatahere')
Example: encode_data('39300000010001010A000700')

Instead of inputting 0x39 for example, you would input 39 (leave out the 0x)
So: 0x39 = 39, 0x30 = 30, 0x00, 0x01
Put them together and you get 39300001, and you would input this into the encoder.

Code:
import hashlib
from base64 import *
from binascii import *
from array import array

def decode_data(data):
    b64dec = urlsafe_b64decode(data)
    data_ar = array('B')
    data_ar.fromstring(b64dec)
    checksum = (eval('0x' + hexlify(data_ar[0:4]))) ^ 0x4a3b2c1d
    dec = data_ar[4:len(data_ar)]
    out = array('B')
    rng = checksum | (checksum << 16) & 0x7fffffff
    for i in range(len(dec)):
        rng = (rng * 0x45 + 0x1111) & 0x7fffffff
        key = (rng >> 16) & 0xff
        out.append((dec[i] ^ key) & 0xff)
    return hexlify(out.tostring())

def calcchk(data):
    check = 0
    data_chr = [data[x:x+2] for x in xrange(0,len(data),2)]
    data_r = array('B')
    for x in data_chr:
        data_r.append(eval('0x'+x+''))
    for x in data_r:
        check = check + x
    return check

def encode_data(data):
    chk = calcchk(data)
    appendchk = hex(chk ^ 0x4a3b2c1d)[2:]
    data_chr = [data[x:x+2] for x in xrange(0,len(data),2)]
    data_ar = array('B')
    out = array('B')
    for x in data_chr:
        data_ar.append(eval('0x'+x+''))
    rng = chk | (chk << 16) & 0x7fffffff
    for i in range(len(data_ar)):
        rng = (rng * 0x45 + 0x1111) & 0x7fffffff
        key = (rng >> 16) & 0xff
        out.append((data_ar[i] ^ key) & 0xff)
    outstring = "".join(out.tostring())
    outstr = unhexlify(appendchk) + outstring
    return urlsafe_b64encode(outstr)
Credits:
ProjectPokemon - GTS Protocol info