function a(input, alphabet) {
    var id = "";
    do {
        id = alphabet.charAt(input % alphabet.length) + id;
        input = Math.floor(input / alphabet.length);
    } while (input);
    return id;
}

function b(alphabet, salt) {
    var integer;
    if (!salt.length) {
        return alphabet;
    }
    alphabet = alphabet.split("");
    for (var i = alphabet.length - 1, v = 0, p = 0, j = 0; i > 0; i--) {
        v = v % salt.length;
        integer = salt.charCodeAt(v);
        p = p + integer;
        j = (integer + v + p) % i;
        var tmp = alphabet[j];
        alphabet[j] = alphabet[i];
        alphabet[i] = tmp;
        v++;
    }
    alphabet = alphabet.join("");
    return alphabet;

}
let base =   '---8afe9dd8da4379f4c7d2fa6e5ae9a79a---#---1693903208580---#------#---.---#---1693903208580---#---ZXJyb3I---#---24---#---MacIntel---#----480---#---en-US---#---1920x1080---#---1920x1055---'
let k1 = 'S9mHXtfaMsZ6DNkgTnL5F0dzpb1lPAocQ8BGh47UqO3';
let k2 = 'eIrWRYiEJwyjvxK';
let data = [];
let num = 0
for (let i = 0; i < base.length; i++) {
    data.push(base.charCodeAt(i))
    num += base.charCodeAt(i)
}
console.log(data+'')
console.log(data.length)
console.log(num)
let idx = 0;
let bIdx1 = k1[num % 43]
console.log(bIdx1)
let res = bIdx1;
while (idx < data.length){
    let t1 = data[idx]
    let tmpKey = (bIdx1 + 'ctrip.com' + k1).slice(0, 43)
    console.log(tmpKey)
    let key = b(k1, tmpKey)
    console.log(key)
    console.log()
    let str2 = a(t1, key)
    res += str2
    let t2 = str2.charCodeAt(0)
    t2 = t2 + idx
    let t3 = t1 % t2
    let t4 = t3 % 15
    res += k2[t4]
    console.log('t4', t4)
    k1 = key
    idx ++
    console.log('res', res)

}
console.log(res.length)