Skip to content

Instantly share code, notes, and snippets.

@wangtubs
Last active October 28, 2016 20:11
Show Gist options
  • Save wangtubs/b660b68a021f96c4aa2d705b0f39bb71 to your computer and use it in GitHub Desktop.
Save wangtubs/b660b68a021f96c4aa2d705b0f39bb71 to your computer and use it in GitHub Desktop.
function _n(key,a) {
var b = "",
e,
c,
h,
f,
g,
d = 0,
a = a.replace(/[^A-Za-z0-9\+\/\=]/g, "");
64 == this.key.length && (this.key += "=");
for (a += ["", "===", "==", "="][a.length % 4]; d < a.length;) e = key.indexOf(a.charAt(d++)),
c = key.indexOf(a.charAt(d++)),
f = key.indexOf(a.charAt(d++)),
g = key.indexOf(a.charAt(d++)),
e = e << 2 | c >> 4,
c = (c & 15) << 4 | f >> 2,
h = (f & 3) << 6 | g,
b += String.fromCharCode(e),
64 != f && (b += String.fromCharCode(c)),
64 != g && (b += String.fromCharCode(h));
return b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment