Skip to content

Instantly share code, notes, and snippets.

@bdbai
Created January 26, 2016 07:56
Show Gist options
  • Save bdbai/791467fd6d56b5718886 to your computer and use it in GitHub Desktop.
Save bdbai/791467fd6d56b5718886 to your computer and use it in GitHub Desktop.
TvCat Encrypt Algorithm
var A = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
J: function(a) {
var b = "";
var c, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
a = A._C(a);
while (i < a.length) {
c = a.charCodeAt(i++);
chr2 = a.charCodeAt(i++);
chr3 = a.charCodeAt(i++);
enc1 = c >> 2;
enc2 = ((c & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64
} else if (isNaN(chr3)) {
enc4 = 64
}
b = b + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4)
}
return b
},
_C: function(a) {
a = a.replace(/\r\n/g, "\n");
var b = "";
for (var n = 0; n < a.length; n++) {
var c = a.charCodeAt(n);
if (c < 128) {
b += String.fromCharCode(c)
} else if ((c > 127) && (c < 2048)) {
b += String.fromCharCode((c >> 6) | 192);
b += String.fromCharCode((c & 63) | 128)
} else {
b += String.fromCharCode((c >> 12) | 224);
b += String.fromCharCode(((c >> 6) & 63) | 128);
b += String.fromCharCode((c & 63) | 128)
}
}
return b
},
E: function(a) {
$(':input[name="ed"]', a).val(A.J('l' + $(".ed", a).val() + 'o'))
},
B: function(a) {
var b = (new Date()).getTime();
if (a != undefined) return A.J(a + '|' + b);
else return A.J('' + b)
},
e: function(u) {
var x = 1;
var f = $('form').first();
var a = f.find("input[class='baidu']");
if (a != undefined) {
x = 2
} else if (u != undefined) {
x = u
}
if (f == undefined) return x;
return f.attr('a')
},
c: function(e) {
var v;
var f = $('form').first();
if (f == undefined) return "";
var s = f.find("*[type='submit']");
if (s == undefined) {
v = f.find("input[class='qq']");
if (v == undefined) return "";
v = e
}
v = s.attr('id');
return v
},
d: function(p, h) {
var v = A.w(h);
var a = $("div.fix");
var x = a || p;
if (a != undefined) {
x = h || $("s.fix1")
}
x = A.c();
var b = new Date();
var c = b.getUTCDate();
var d = b.getDay();
var i = d == 0 ? 7 : d;
i = i * i;
var F = this._keyStr.charAt(i);
return F + A.J(x + "|" + A.e(p)) + v
},
w: function(v) {
var t = $("head");
var a = "|";
if (t == undefined) {
tl = "/"
} else {
tl = v
}
var r = A.J(a + k(tl));
return r
},
s: function(a, b) {
var c = this._keyStr.charAt(37);
return A.J(c + a)
}
};
$(function() {
var b = "src";
var d = A.d("a", b);
$.get("/api/pg", {
p: d
},
function(a) {
if (a[0] == 1) {
$("#noon").after(a[1])
}
},
"json")
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment