Failed to decode base64 in javascript - javascript

I receive an id_token as part of my current href. It is encoded in base64. I try to decode it using atob(extractedIdToken), but get the following error:
Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded
When I copy and paste the extracted id_token in my code and go to an online decoding site, it decodes correctly. Do you have suggestion?

I always use this to decode and encode in Base64, try it
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function (e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
},
decode: function (e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9+/=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = Base64._utf8_decode(t);
return t
},
_utf8_encode: function (e) {
e = e.replace(/rn/g, "n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128)
}
}
return t
},
_utf8_decode: function (e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
n += 3
}
}
return t
}
};

Thanks all for your answers. I ended up moving the Base64 decoding process to the Java backend using the java package: java.util.Base64.

In my case, the issue was that the encoded string should have been treated as segments. Just separate the code with the separator "." or whatever your case is. Then, decode only the different parts separately. This resolved my issue and I was able to decode using window.atob(). Hope this helps.

Related

how to generate SHA256 with 32 bytes for a given string?

I am looking for javascript code for generating a SHA256 with 32 bytes for a given string
this code is suppose to work inside a browser so it should work without any dependencies
so far I found the following function that gives 64 bytes SHA256:
/**
* Secure Hash Algorithm (SHA256)
* http://www.webtoolkit.info/
* Original code by Angel Marin, Paul Johnston
**/
function SHA256(s){
var chrsz = 8;
var hexcase = 0;
function safe_add (x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
function S (X, n) { return ( X >>> n ) | (X << (32 - n)); }
function R (X, n) { return ( X >>> n ); }
function Ch(x, y, z) { return ((x & y) ^ ((~x) & z)); }
function Maj(x, y, z) { return ((x & y) ^ (x & z) ^ (y & z)); }
function Sigma0256(x) { return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); }
function Sigma1256(x) { return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); }
function Gamma0256(x) { return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); }
function Gamma1256(x) { return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); }
function core_sha256 (m, l) {
var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2);
var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
var W = new Array(64);
var a, b, c, d, e, f, g, h, i, j;
var T1, T2;
m[l >> 5] |= 0x80 << (24 - l % 32);
m[((l + 64 >> 9) << 4) + 15] = l;
for ( var i = 0; i<m.length; i+=16 ) {
a = HASH[0];
b = HASH[1];
c = HASH[2];
d = HASH[3];
e = HASH[4];
f = HASH[5];
g = HASH[6];
h = HASH[7];
for ( var j = 0; j<64; j++) {
if (j < 16) W[j] = m[j + i];
else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);
T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);
T2 = safe_add(Sigma0256(a), Maj(a, b, c));
h = g;
g = f;
f = e;
e = safe_add(d, T1);
d = c;
c = b;
b = a;
a = safe_add(T1, T2);
}
HASH[0] = safe_add(a, HASH[0]);
HASH[1] = safe_add(b, HASH[1]);
HASH[2] = safe_add(c, HASH[2]);
HASH[3] = safe_add(d, HASH[3]);
HASH[4] = safe_add(e, HASH[4]);
HASH[5] = safe_add(f, HASH[5]);
HASH[6] = safe_add(g, HASH[6]);
HASH[7] = safe_add(h, HASH[7]);
}
return HASH;
}
function str2binb (str) {
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz) {
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i % 32);
}
return bin;
}
function Utf8Encode(string) {
string = string.replace(/\r\n/g,'\n');
var utftext = '';
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
function binb2hex (binarray) {
var hex_tab = hexcase ? '0123456789ABCDEF' : '0123456789abcdef';
var str = '';
for(var i = 0; i < binarray.length * 4; i++) {
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i % 4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((3 - i % 4)*8 )) & 0xF);
}
return str;
}
s = Utf8Encode(s);
return binb2hex(core_sha256(str2binb(s), s.length * chrsz));
}
The result you're receiving actually are 32 bytes.
Let's have a look at an example:
console.log(SHA256("test"));
returns:
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
What we see is a string representation of 32 bytes which results in 64 bytes of individual chars. However a group of two chars is actually one byte, ranging from 0 up to 255 in decimal.
9f (hex) -> 10011111 (binary) -> 159 (decimal)
86 (hex) -> 10000110 (binary) -> 134 (decimal)
and so on.
If you want to store the 64 character sequence as 'real' 32 bytes, you need to convert pairs of two characters to an 8-bit unsigned integer value (0-255) and put those in a JavaScript typed array.
For example ...
let hexString = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08";
let unsignedIntegers = hexString.match(/[\dA-F]{2}/gi).map(function(s) {
return parseInt(s, 16);
});
let typedArray = new Uint8Array(unsignedIntegers);
console.log(typedArray);
... gives a 32 bytes Uint8Array.

Encode and decode skipping the characters

I am trying to store some strings into the database using their encoded format. But when retrieving back the string is malformed.
Here is my code example where you easily can see that String passed to encode is not the same as after decode. Why is this happening?
Is there any other library which can help me encoding and decoding? Any suggestion on the same will be helpful.
var Base64 = {
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode : function(e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o)
+ this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
},
decode : function(e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9+/=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = Base64._utf8_decode(t);
return t
},
_utf8_encode : function(e) {
e = e.replace(/rn/g, "n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128)
}
}
return t
},
_utf8_decode : function(e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3
& 63);
n += 3
}
}
return t
}
}
var str = "background:url(/drona-courses/player_assets/skin_0/DRONA_default_skinRightCorner.png) ;"
var encoded = Base64.encode(str);
//console.log(encoded);
var decoded = Base64.decode(encoded);
console.log(str,"......Input");
console.log(decoded,".....Output");
Base64 Encoding in common browsers
In JavaScript there are two functions respectively for decoding and encoding base64 strings:
atob()
btoa()
The atob() function decodes a string of data which has been encoded using base-64 encoding. Conversely, the btoa() function creates a base-64 encoded ASCII string from a "string" of binary data.
Use atob and btoa.
const foo = "bar"
const encodedFoo = btoa(foo)
const decodedFoo = atob(encodedFoo)
console.log(encodedFoo)
console.log(decodedFoo)
You can read more about it here.

FireFox Extenstion - Using Components - Hex Decoding

I am working on a FireFox Extension and want to know what are these codes and what do they do :
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
var wm = Components.classes["#mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var windows = wm.getEnumerator("navigator:browser");
global_win = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
var my_integer = check_me_1() + check_me_2();
alert(my_integer);
function check_me_1() {
try {
var _0x2cb6 = ["\x4E\x74\x74", "\x77\x69\x64\x74\x68", "\x73\x63\x72\x65\x65\x6E", "\x2E", "\x68\x65\x69\x67\x68\x74", "\x0A", "\x72\x65\x70\x6C\x61\x63\x65", "", "\x6C\x65\x6E\x67\x74\x68", "\x63\x68\x61\x72\x43\x6F\x64\x65\x41\x74", "\x66\x72\x6F\x6D\x43\x68\x61\x72\x43\x6F\x64\x65", "\x30\x30\x30\x30\x30\x30\x30\x30\x20\x37\x37\x30\x37\x33\x30\x39\x36\x20\x45\x45\x30\x45\x36\x31\x32\x43\x20\x39\x39\x30\x39\x35\x31\x42\x41\x20\x30\x37\x36\x44\x43\x34\x31\x39\x20\x37\x30\x36\x41\x46\x34\x38\x46\x20\x45\x39\x36\x33\x41\x35\x33\x35\x20\x39\x45\x36\x34\x39\x35\x41\x33\x20\x30\x45\x44\x42\x38\x38\x33\x32\x20\x37\x39\x44\x43\x42\x38\x41\x34\x20\x45\x30\x44\x35\x45\x39\x31\x45\x20\x39\x37\x44\x32\x44\x39\x38\x38\x20\x30\x39\x42\x36\x34\x43\x32\x42\x20\x37\x45\x42\x31\x37\x43\x42\x44\x20\x45\x37\x42\x38\x32\x44\x30\x37\x20\x39\x30\x42\x46\x31\x44\x39\x31\x20\x31\x44\x42\x37\x31\x30\x36\x34\x20\x36\x41\x42\x30\x32\x30\x46\x32\x20\x46\x33\x42\x39\x37\x31\x34\x38\x20\x38\x34\x42\x45\x34\x31\x44\x45\x20\x31\x41\x44\x41\x44\x34\x37\x44\x20\x36\x44\x44\x44\x45\x34\x45\x42\x20\x46\x34\x44\x34\x42\x35\x35\x31\x20\x38\x33\x44\x33\x38\x35\x43\x37\x20\x31\x33\x36\x43\x39\x38\x35\x36\x20\x36\x34\x36\x42\x41\x38\x43\x30\x20\x46\x44\x36\x32\x46\x39\x37\x41\x20\x38\x41\x36\x35\x43\x39\x45\x43\x20\x31\x34\x30\x31\x35\x43\x34\x46\x20\x36\x33\x30\x36\x36\x43\x44\x39\x20\x46\x41\x30\x46\x33\x44\x36\x33\x20\x38\x44\x30\x38\x30\x44\x46\x35\x20\x33\x42\x36\x45\x32\x30\x43\x38\x20\x34\x43\x36\x39\x31\x30\x35\x45\x20\x44\x35\x36\x30\x34\x31\x45\x34\x20\x41\x32\x36\x37\x37\x31\x37\x32\x20\x33\x43\x30\x33\x45\x34\x44\x31\x20\x34\x42\x30\x34\x44\x34\x34\x37\x20\x44\x32\x30\x44\x38\x35\x46\x44\x20\x41\x35\x30\x41\x42\x35\x36\x42\x20\x33\x35\x42\x35\x41\x38\x46\x41\x20\x34\x32\x42\x32\x39\x38\x36\x43\x20\x44\x42\x42\x42\x43\x39\x44\x36\x20\x41\x43\x42\x43\x46\x39\x34\x30\x20\x33\x32\x44\x38\x36\x43\x45\x33\x20\x34\x35\x44\x46\x35\x43\x37\x35\x20\x44\x43\x44\x36\x30\x44\x43\x46\x20\x41\x42\x44\x31\x33\x44\x35\x39\x20\x32\x36\x44\x39\x33\x30\x41\x43\x20\x35\x31\x44\x45\x30\x30\x33\x41\x20\x43\x38\x44\x37\x35\x31\x38\x30\x20\x42\x46\x44\x30\x36\x31\x31\x36\x20\x32\x31\x42\x34\x46\x34\x42\x35\x20\x35\x36\x42\x33\x43\x34\x32\x33\x20\x43\x46\x42\x41\x39\x35\x39\x39\x20\x42\x38\x42\x44\x41\x35\x30\x46\x20\x32\x38\x30\x32\x42\x38\x39\x45\x20\x35\x46\x30\x35\x38\x38\x30\x38\x20\x43\x36\x30\x43\x44\x39\x42\x32\x20\x42\x31\x30\x42\x45\x39\x32\x34\x20\x32\x46\x36\x46\x37\x43\x38\x37\x20\x35\x38\x36\x38\x34\x43\x31\x31\x20\x43\x31\x36\x31\x31\x44\x41\x42\x20\x42\x36\x36\x36\x32\x44\x33\x44\x20\x37\x36\x44\x43\x34\x31\x39\x30\x20\x30\x31\x44\x42\x37\x31\x30\x36\x20\x39\x38\x44\x32\x32\x30\x42\x43\x20\x45\x46\x44\x35\x31\x30\x32\x41\x20\x37\x31\x42\x31\x38\x35\x38\x39\x20\x30\x36\x42\x36\x42\x35\x31\x46\x20\x39\x46\x42\x46\x45\x34\x41\x35\x20\x45\x38\x42\x38\x44\x34\x33\x33\x20\x37\x38\x30\x37\x43\x39\x41\x32\x20\x30\x46\x30\x30\x46\x39\x33\x34\x20\x39\x36\x30\x39\x41\x38\x38\x45\x20\x45\x31\x30\x45\x39\x38\x31\x38\x20\x37\x46\x36\x41\x30\x44\x42\x42\x20\x30\x38\x36\x44\x33\x44\x32\x44\x20\x39\x31\x36\x34\x36\x43\x39\x37\x20\x45\x36\x36\x33\x35\x43\x30\x31\x20\x36\x42\x36\x42\x35\x31\x46\x34\x20\x31\x43\x36\x43\x36\x31\x36\x32\x20\x38\x35\x36\x35\x33\x30\x44\x38\x20\x46\x32\x36\x32\x30\x30\x34\x45\x20\x36\x43\x30\x36\x39\x35\x45\x44\x20\x31\x42\x30\x31\x41\x35\x37\x42\x20\x38\x32\x30\x38\x46\x34\x43\x31\x20\x46\x35\x30\x46\x43\x34\x35\x37\x20\x36\x35\x42\x30\x44\x39\x43\x36\x20\x31\x32\x42\x37\x45\x39\x35\x30\x20\x38\x42\x42\x45\x42\x38\x45\x41\x20\x46\x43\x42\x39\x38\x38\x37\x43\x20\x36\x32\x44\x44\x31\x44\x44\x46\x20\x31\x35\x44\x41\x32\x44\x34\x39\x20\x38\x43\x44\x33\x37\x43\x46\x33\x20\x46\x42\x44\x34\x34\x43\x36\x35\x20\x34\x44\x42\x32\x36\x31\x35\x38\x20\x33\x41\x42\x35\x35\x31\x43\x45\x20\x41\x33\x42\x43\x30\x30\x37\x34\x20\x44\x34\x42\x42\x33\x30\x45\x32\x20\x34\x41\x44\x46\x41\x35\x34\x31\x20\x33\x44\x44\x38\x39\x35\x44\x37\x20\x41\x34\x44\x31\x43\x34\x36\x44\x20\x44\x33\x44\x36\x46\x34\x46\x42\x20\x34\x33\x36\x39\x45\x39\x36\x41\x20\x33\x34\x36\x45\x44\x39\x46\x43\x20\x41\x44\x36\x37\x38\x38\x34\x36\x20\x44\x41\x36\x30\x42\x38\x44\x30\x20\x34\x34\x30\x34\x32\x44\x37\x33\x20\x33\x33\x30\x33\x31\x44\x45\x35\x20\x41\x41\x30\x41\x34\x43\x35\x46\x20\x44\x44\x30\x44\x37\x43\x43\x39\x20\x35\x30\x30\x35\x37\x31\x33\x43\x20\x32\x37\x30\x32\x34\x31\x41\x41\x20\x42\x45\x30\x42\x31\x30\x31\x30\x20\x43\x39\x30\x43\x32\x30\x38\x36\x20\x35\x37\x36\x38\x42\x35\x32\x35\x20\x32\x30\x36\x46\x38\x35\x42\x33\x20\x42\x39\x36\x36\x44\x34\x30\x39\x20\x43\x45\x36\x31\x45\x34\x39\x46\x20\x35\x45\x44\x45\x46\x39\x30\x45\x20\x32\x39\x44\x39\x43\x39\x39\x38\x20\x42\x30\x44\x30\x39\x38\x32\x32\x20\x43\x37\x44\x37\x41\x38\x42\x34\x20\x35\x39\x42\x33\x33\x44\x31\x37\x20\x32\x45\x42\x34\x30\x44\x38\x31\x20\x42\x37\x42\x44\x35\x43\x33\x42\x20\x43\x30\x42\x41\x36\x43\x41\x44\x20\x45\x44\x42\x38\x38\x33\x32\x30\x20\x39\x41\x42\x46\x42\x33\x42\x36\x20\x30\x33\x42\x36\x45\x32\x30\x43\x20\x37\x34\x42\x31\x44\x32\x39\x41\x20\x45\x41\x44\x35\x34\x37\x33\x39\x20\x39\x44\x44\x32\x37\x37\x41\x46\x20\x30\x34\x44\x42\x32\x36\x31\x35\x20\x37\x33\x44\x43\x31\x36\x38\x33\x20\x45\x33\x36\x33\x30\x42\x31\x32\x20\x39\x34\x36\x34\x33\x42\x38\x34\x20\x30\x44\x36\x44\x36\x41\x33\x45\x20\x37\x41\x36\x41\x35\x41\x41\x38\x20\x45\x34\x30\x45\x43\x46\x30\x42\x20\x39\x33\x30\x39\x46\x46\x39\x44\x20\x30\x41\x30\x30\x41\x45\x32\x37\x20\x37\x44\x30\x37\x39\x45\x42\x31\x20\x46\x30\x30\x46\x39\x33\x34\x34\x20\x38\x37\x30\x38\x41\x33\x44\x32\x20\x31\x45\x30\x31\x46\x32\x36\x38\x20\x36\x39\x30\x36\x43\x32\x46\x45\x20\x46\x37\x36\x32\x35\x37\x35\x44\x20\x38\x30\x36\x35\x36\x37\x43\x42\x20\x31\x39\x36\x43\x33\x36\x37\x31\x20\x36\x45\x36\x42\x30\x36\x45\x37\x20\x46\x45\x44\x34\x31\x42\x37\x36\x20\x38\x39\x44\x33\x32\x42\x45\x30\x20\x31\x30\x44\x41\x37\x41\x35\x41\x20\x36\x37\x44\x44\x34\x41\x43\x43\x20\x46\x39\x42\x39\x44\x46\x36\x46\x20\x38\x45\x42\x45\x45\x46\x46\x39\x20\x31\x37\x42\x37\x42\x45\x34\x33\x20\x36\x30\x42\x30\x38\x45\x44\x35\x20\x44\x36\x44\x36\x41\x33\x45\x38\x20\x41\x31\x44\x31\x39\x33\x37\x45\x20\x33\x38\x44\x38\x43\x32\x43\x34\x20\x34\x46\x44\x46\x46\x32\x35\x32\x20\x44\x31\x42\x42\x36\x37\x46\x31\x20\x41\x36\x42\x43\x35\x37\x36\x37\x20\x33\x46\x42\x35\x30\x36\x44\x44\x20\x34\x38\x42\x32\x33\x36\x34\x42\x20\x44\x38\x30\x44\x32\x42\x44\x41\x20\x41\x46\x30\x41\x31\x42\x34\x43\x20\x33\x36\x30\x33\x34\x41\x46\x36\x20\x34\x31\x30\x34\x37\x41\x36\x30\x20\x44\x46\x36\x30\x45\x46\x43\x33\x20\x41\x38\x36\x37\x44\x46\x35\x35\x20\x33\x31\x36\x45\x38\x45\x45\x46\x20\x34\x36\x36\x39\x42\x45\x37\x39\x20\x43\x42\x36\x31\x42\x33\x38\x43\x20\x42\x43\x36\x36\x38\x33\x31\x41\x20\x32\x35\x36\x46\x44\x32\x41\x30\x20\x35\x32\x36\x38\x45\x32\x33\x36\x20\x43\x43\x30\x43\x37\x37\x39\x35\x20\x42\x42\x30\x42\x34\x37\x30\x33\x20\x32\x32\x30\x32\x31\x36\x42\x39\x20\x35\x35\x30\x35\x32\x36\x32\x46\x20\x43\x35\x42\x41\x33\x42\x42\x45\x20\x42\x32\x42\x44\x30\x42\x32\x38\x20\x32\x42\x42\x34\x35\x41\x39\x32\x20\x35\x43\x42\x33\x36\x41\x30\x34\x20\x43\x32\x44\x37\x46\x46\x41\x37\x20\x42\x35\x44\x30\x43\x46\x33\x31\x20\x32\x43\x44\x39\x39\x45\x38\x42\x20\x35\x42\x44\x45\x41\x45\x31\x44\x20\x39\x42\x36\x34\x43\x32\x42\x30\x20\x45\x43\x36\x33\x46\x32\x32\x36\x20\x37\x35\x36\x41\x41\x33\x39\x43\x20\x30\x32\x36\x44\x39\x33\x30\x41\x20\x39\x43\x30\x39\x30\x36\x41\x39\x20\x45\x42\x30\x45\x33\x36\x33\x46\x20\x37\x32\x30\x37\x36\x37\x38\x35\x20\x30\x35\x30\x30\x35\x37\x31\x33\x20\x39\x35\x42\x46\x34\x41\x38\x32\x20\x45\x32\x42\x38\x37\x41\x31\x34\x20\x37\x42\x42\x31\x32\x42\x41\x45\x20\x30\x43\x42\x36\x31\x42\x33\x38\x20\x39\x32\x44\x32\x38\x45\x39\x42\x20\x45\x35\x44\x35\x42\x45\x30\x44\x20\x37\x43\x44\x43\x45\x46\x42\x37\x20\x30\x42\x44\x42\x44\x46\x32\x31\x20\x38\x36\x44\x33\x44\x32\x44\x34\x20\x46\x31\x44\x34\x45\x32\x34\x32\x20\x36\x38\x44\x44\x42\x33\x46\x38\x20\x31\x46\x44\x41\x38\x33\x36\x45\x20\x38\x31\x42\x45\x31\x36\x43\x44\x20\x46\x36\x42\x39\x32\x36\x35\x42\x20\x36\x46\x42\x30\x37\x37\x45\x31\x20\x31\x38\x42\x37\x34\x37\x37\x37\x20\x38\x38\x30\x38\x35\x41\x45\x36\x20\x46\x46\x30\x46\x36\x41\x37\x30\x20\x36\x36\x30\x36\x33\x42\x43\x41\x20\x31\x31\x30\x31\x30\x42\x35\x43\x20\x38\x46\x36\x35\x39\x45\x46\x46\x20\x46\x38\x36\x32\x41\x45\x36\x39\x20\x36\x31\x36\x42\x46\x46\x44\x33\x20\x31\x36\x36\x43\x43\x46\x34\x35\x20\x41\x30\x30\x41\x45\x32\x37\x38\x20\x44\x37\x30\x44\x44\x32\x45\x45\x20\x34\x45\x30\x34\x38\x33\x35\x34\x20\x33\x39\x30\x33\x42\x33\x43\x32\x20\x41\x37\x36\x37\x32\x36\x36\x31\x20\x44\x30\x36\x30\x31\x36\x46\x37\x20\x34\x39\x36\x39\x34\x37\x34\x44\x20\x33\x45\x36\x45\x37\x37\x44\x42\x20\x41\x45\x44\x31\x36\x41\x34\x41\x20\x44\x39\x44\x36\x35\x41\x44\x43\x20\x34\x30\x44\x46\x30\x42\x36\x36\x20\x33\x37\x44\x38\x33\x42\x46\x30\x20\x41\x39\x42\x43\x41\x45\x35\x33\x20\x44\x45\x42\x42\x39\x45\x43\x35\x20\x34\x37\x42\x32\x43\x46\x37\x46\x20\x33\x30\x42\x35\x46\x46\x45\x39\x20\x42\x44\x42\x44\x46\x32\x31\x43\x20\x43\x41\x42\x41\x43\x32\x38\x41\x20\x35\x33\x42\x33\x39\x33\x33\x30\x20\x32\x34\x42\x34\x41\x33\x41\x36\x20\x42\x41\x44\x30\x33\x36\x30\x35\x20\x43\x44\x44\x37\x30\x36\x39\x33\x20\x35\x34\x44\x45\x35\x37\x32\x39\x20\x32\x33\x44\x39\x36\x37\x42\x46\x20\x42\x33\x36\x36\x37\x41\x32\x45\x20\x43\x34\x36\x31\x34\x41\x42\x38\x20\x35\x44\x36\x38\x31\x42\x30\x32\x20\x32\x41\x36\x46\x32\x42\x39\x34\x20\x42\x34\x30\x42\x42\x45\x33\x37\x20\x43\x33\x30\x43\x38\x45\x41\x31\x20\x35\x41\x30\x35\x44\x46\x31\x42\x20\x32\x44\x30\x32\x45\x46\x38\x44", "\x30\x78", "\x73\x75\x62\x73\x74\x72"];
str = _0x2cb6[0] + global_win[_0x2cb6[2]][_0x2cb6[1]] + _0x2cb6[3] + global_win[_0x2cb6[2]][_0x2cb6[4]];
str = str[_0x2cb6[6]](/\r\n/g, _0x2cb6[5]);
var utftext = _0x2cb6[7];
for (var n = 0; n < str[_0x2cb6[8]]; n++) {
var c = str[_0x2cb6[9]](n);
if (c < 128) {
utftext += String[_0x2cb6[10]](c);
} else {
if ((c > 127) && (c < 2048)) {
utftext += String[_0x2cb6[10]]((c >> 6) | 192);
utftext += String[_0x2cb6[10]]((c & 63) | 128);
} else {
utftext += String[_0x2cb6[10]]((c >> 12) | 224);
utftext += String[_0x2cb6[10]](((c >> 6) & 63) | 128);
utftext += String[_0x2cb6[10]]((c & 63) | 128);
};
};
};
str = utftext;
var table = _0x2cb6[11];
var crc = 0;
var x = 0;
var y = 0;
crc = crc ^ (-1);
for (var i = 0, iTop = str[_0x2cb6[8]]; i < iTop; i++) {
y = (crc ^ str[_0x2cb6[9]](i)) & 0xFF;
x = _0x2cb6[12] + table[_0x2cb6[13]](y * 9, 8);
crc = (crc >>> 8) ^ x;
};
global_variable = crc ^ (-1);
return parseInt(global_variable);
} catch (exc) {
return 0;
}
}
function check_me_2() {
try {
var _0x3ed1 = ["", "\x70\x6C\x75\x67\x69\x6E\x73", "\x6E\x61\x76\x69\x67\x61\x74\x6F\x72", "\x6C\x65\x6E\x67\x74\x68", "\x66\x69\x6C\x65\x6E\x61\x6D\x65", "\x0A", "\x72\x65\x70\x6C\x61\x63\x65", "\x63\x68\x61\x72\x43\x6F\x64\x65\x41\x74", "\x66\x72\x6F\x6D\x43\x68\x61\x72\x43\x6F\x64\x65", "\x30\x30\x30\x30\x30\x30\x30\x30\x20\x37\x37\x30\x37\x33\x30\x39\x36\x20\x45\x45\x30\x45\x36\x31\x32\x43\x20\x39\x39\x30\x39\x35\x31\x42\x41\x20\x30\x37\x36\x44\x43\x34\x31\x39\x20\x37\x30\x36\x41\x46\x34\x38\x46\x20\x45\x39\x36\x33\x41\x35\x33\x35\x20\x39\x45\x36\x34\x39\x35\x41\x33\x20\x30\x45\x44\x42\x38\x38\x33\x32\x20\x37\x39\x44\x43\x42\x38\x41\x34\x20\x45\x30\x44\x35\x45\x39\x31\x45\x20\x39\x37\x44\x32\x44\x39\x38\x38\x20\x30\x39\x42\x36\x34\x43\x32\x42\x20\x37\x45\x42\x31\x37\x43\x42\x44\x20\x45\x37\x42\x38\x32\x44\x30\x37\x20\x39\x30\x42\x46\x31\x44\x39\x31\x20\x31\x44\x42\x37\x31\x30\x36\x34\x20\x36\x41\x42\x30\x32\x30\x46\x32\x20\x46\x33\x42\x39\x37\x31\x34\x38\x20\x38\x34\x42\x45\x34\x31\x44\x45\x20\x31\x41\x44\x41\x44\x34\x37\x44\x20\x36\x44\x44\x44\x45\x34\x45\x42\x20\x46\x34\x44\x34\x42\x35\x35\x31\x20\x38\x33\x44\x33\x38\x35\x43\x37\x20\x31\x33\x36\x43\x39\x38\x35\x36\x20\x36\x34\x36\x42\x41\x38\x43\x30\x20\x46\x44\x36\x32\x46\x39\x37\x41\x20\x38\x41\x36\x35\x43\x39\x45\x43\x20\x31\x34\x30\x31\x35\x43\x34\x46\x20\x36\x33\x30\x36\x36\x43\x44\x39\x20\x46\x41\x30\x46\x33\x44\x36\x33\x20\x38\x44\x30\x38\x30\x44\x46\x35\x20\x33\x42\x36\x45\x32\x30\x43\x38\x20\x34\x43\x36\x39\x31\x30\x35\x45\x20\x44\x35\x36\x30\x34\x31\x45\x34\x20\x41\x32\x36\x37\x37\x31\x37\x32\x20\x33\x43\x30\x33\x45\x34\x44\x31\x20\x34\x42\x30\x34\x44\x34\x34\x37\x20\x44\x32\x30\x44\x38\x35\x46\x44\x20\x41\x35\x30\x41\x42\x35\x36\x42\x20\x33\x35\x42\x35\x41\x38\x46\x41\x20\x34\x32\x42\x32\x39\x38\x36\x43\x20\x44\x42\x42\x42\x43\x39\x44\x36\x20\x41\x43\x42\x43\x46\x39\x34\x30\x20\x33\x32\x44\x38\x36\x43\x45\x33\x20\x34\x35\x44\x46\x35\x43\x37\x35\x20\x44\x43\x44\x36\x30\x44\x43\x46\x20\x41\x42\x44\x31\x33\x44\x35\x39\x20\x32\x36\x44\x39\x33\x30\x41\x43\x20\x35\x31\x44\x45\x30\x30\x33\x41\x20\x43\x38\x44\x37\x35\x31\x38\x30\x20\x42\x46\x44\x30\x36\x31\x31\x36\x20\x32\x31\x42\x34\x46\x34\x42\x35\x20\x35\x36\x42\x33\x43\x34\x32\x33\x20\x43\x46\x42\x41\x39\x35\x39\x39\x20\x42\x38\x42\x44\x41\x35\x30\x46\x20\x32\x38\x30\x32\x42\x38\x39\x45\x20\x35\x46\x30\x35\x38\x38\x30\x38\x20\x43\x36\x30\x43\x44\x39\x42\x32\x20\x42\x31\x30\x42\x45\x39\x32\x34\x20\x32\x46\x36\x46\x37\x43\x38\x37\x20\x35\x38\x36\x38\x34\x43\x31\x31\x20\x43\x31\x36\x31\x31\x44\x41\x42\x20\x42\x36\x36\x36\x32\x44\x33\x44\x20\x37\x36\x44\x43\x34\x31\x39\x30\x20\x30\x31\x44\x42\x37\x31\x30\x36\x20\x39\x38\x44\x32\x32\x30\x42\x43\x20\x45\x46\x44\x35\x31\x30\x32\x41\x20\x37\x31\x42\x31\x38\x35\x38\x39\x20\x30\x36\x42\x36\x42\x35\x31\x46\x20\x39\x46\x42\x46\x45\x34\x41\x35\x20\x45\x38\x42\x38\x44\x34\x33\x33\x20\x37\x38\x30\x37\x43\x39\x41\x32\x20\x30\x46\x30\x30\x46\x39\x33\x34\x20\x39\x36\x30\x39\x41\x38\x38\x45\x20\x45\x31\x30\x45\x39\x38\x31\x38\x20\x37\x46\x36\x41\x30\x44\x42\x42\x20\x30\x38\x36\x44\x33\x44\x32\x44\x20\x39\x31\x36\x34\x36\x43\x39\x37\x20\x45\x36\x36\x33\x35\x43\x30\x31\x20\x36\x42\x36\x42\x35\x31\x46\x34\x20\x31\x43\x36\x43\x36\x31\x36\x32\x20\x38\x35\x36\x35\x33\x30\x44\x38\x20\x46\x32\x36\x32\x30\x30\x34\x45\x20\x36\x43\x30\x36\x39\x35\x45\x44\x20\x31\x42\x30\x31\x41\x35\x37\x42\x20\x38\x32\x30\x38\x46\x34\x43\x31\x20\x46\x35\x30\x46\x43\x34\x35\x37\x20\x36\x35\x42\x30\x44\x39\x43\x36\x20\x31\x32\x42\x37\x45\x39\x35\x30\x20\x38\x42\x42\x45\x42\x38\x45\x41\x20\x46\x43\x42\x39\x38\x38\x37\x43\x20\x36\x32\x44\x44\x31\x44\x44\x46\x20\x31\x35\x44\x41\x32\x44\x34\x39\x20\x38\x43\x44\x33\x37\x43\x46\x33\x20\x46\x42\x44\x34\x34\x43\x36\x35\x20\x34\x44\x42\x32\x36\x31\x35\x38\x20\x33\x41\x42\x35\x35\x31\x43\x45\x20\x41\x33\x42\x43\x30\x30\x37\x34\x20\x44\x34\x42\x42\x33\x30\x45\x32\x20\x34\x41\x44\x46\x41\x35\x34\x31\x20\x33\x44\x44\x38\x39\x35\x44\x37\x20\x41\x34\x44\x31\x43\x34\x36\x44\x20\x44\x33\x44\x36\x46\x34\x46\x42\x20\x34\x33\x36\x39\x45\x39\x36\x41\x20\x33\x34\x36\x45\x44\x39\x46\x43\x20\x41\x44\x36\x37\x38\x38\x34\x36\x20\x44\x41\x36\x30\x42\x38\x44\x30\x20\x34\x34\x30\x34\x32\x44\x37\x33\x20\x33\x33\x30\x33\x31\x44\x45\x35\x20\x41\x41\x30\x41\x34\x43\x35\x46\x20\x44\x44\x30\x44\x37\x43\x43\x39\x20\x35\x30\x30\x35\x37\x31\x33\x43\x20\x32\x37\x30\x32\x34\x31\x41\x41\x20\x42\x45\x30\x42\x31\x30\x31\x30\x20\x43\x39\x30\x43\x32\x30\x38\x36\x20\x35\x37\x36\x38\x42\x35\x32\x35\x20\x32\x30\x36\x46\x38\x35\x42\x33\x20\x42\x39\x36\x36\x44\x34\x30\x39\x20\x43\x45\x36\x31\x45\x34\x39\x46\x20\x35\x45\x44\x45\x46\x39\x30\x45\x20\x32\x39\x44\x39\x43\x39\x39\x38\x20\x42\x30\x44\x30\x39\x38\x32\x32\x20\x43\x37\x44\x37\x41\x38\x42\x34\x20\x35\x39\x42\x33\x33\x44\x31\x37\x20\x32\x45\x42\x34\x30\x44\x38\x31\x20\x42\x37\x42\x44\x35\x43\x33\x42\x20\x43\x30\x42\x41\x36\x43\x41\x44\x20\x45\x44\x42\x38\x38\x33\x32\x30\x20\x39\x41\x42\x46\x42\x33\x42\x36\x20\x30\x33\x42\x36\x45\x32\x30\x43\x20\x37\x34\x42\x31\x44\x32\x39\x41\x20\x45\x41\x44\x35\x34\x37\x33\x39\x20\x39\x44\x44\x32\x37\x37\x41\x46\x20\x30\x34\x44\x42\x32\x36\x31\x35\x20\x37\x33\x44\x43\x31\x36\x38\x33\x20\x45\x33\x36\x33\x30\x42\x31\x32\x20\x39\x34\x36\x34\x33\x42\x38\x34\x20\x30\x44\x36\x44\x36\x41\x33\x45\x20\x37\x41\x36\x41\x35\x41\x41\x38\x20\x45\x34\x30\x45\x43\x46\x30\x42\x20\x39\x33\x30\x39\x46\x46\x39\x44\x20\x30\x41\x30\x30\x41\x45\x32\x37\x20\x37\x44\x30\x37\x39\x45\x42\x31\x20\x46\x30\x30\x46\x39\x33\x34\x34\x20\x38\x37\x30\x38\x41\x33\x44\x32\x20\x31\x45\x30\x31\x46\x32\x36\x38\x20\x36\x39\x30\x36\x43\x32\x46\x45\x20\x46\x37\x36\x32\x35\x37\x35\x44\x20\x38\x30\x36\x35\x36\x37\x43\x42\x20\x31\x39\x36\x43\x33\x36\x37\x31\x20\x36\x45\x36\x42\x30\x36\x45\x37\x20\x46\x45\x44\x34\x31\x42\x37\x36\x20\x38\x39\x44\x33\x32\x42\x45\x30\x20\x31\x30\x44\x41\x37\x41\x35\x41\x20\x36\x37\x44\x44\x34\x41\x43\x43\x20\x46\x39\x42\x39\x44\x46\x36\x46\x20\x38\x45\x42\x45\x45\x46\x46\x39\x20\x31\x37\x42\x37\x42\x45\x34\x33\x20\x36\x30\x42\x30\x38\x45\x44\x35\x20\x44\x36\x44\x36\x41\x33\x45\x38\x20\x41\x31\x44\x31\x39\x33\x37\x45\x20\x33\x38\x44\x38\x43\x32\x43\x34\x20\x34\x46\x44\x46\x46\x32\x35\x32\x20\x44\x31\x42\x42\x36\x37\x46\x31\x20\x41\x36\x42\x43\x35\x37\x36\x37\x20\x33\x46\x42\x35\x30\x36\x44\x44\x20\x34\x38\x42\x32\x33\x36\x34\x42\x20\x44\x38\x30\x44\x32\x42\x44\x41\x20\x41\x46\x30\x41\x31\x42\x34\x43\x20\x33\x36\x30\x33\x34\x41\x46\x36\x20\x34\x31\x30\x34\x37\x41\x36\x30\x20\x44\x46\x36\x30\x45\x46\x43\x33\x20\x41\x38\x36\x37\x44\x46\x35\x35\x20\x33\x31\x36\x45\x38\x45\x45\x46\x20\x34\x36\x36\x39\x42\x45\x37\x39\x20\x43\x42\x36\x31\x42\x33\x38\x43\x20\x42\x43\x36\x36\x38\x33\x31\x41\x20\x32\x35\x36\x46\x44\x32\x41\x30\x20\x35\x32\x36\x38\x45\x32\x33\x36\x20\x43\x43\x30\x43\x37\x37\x39\x35\x20\x42\x42\x30\x42\x34\x37\x30\x33\x20\x32\x32\x30\x32\x31\x36\x42\x39\x20\x35\x35\x30\x35\x32\x36\x32\x46\x20\x43\x35\x42\x41\x33\x42\x42\x45\x20\x42\x32\x42\x44\x30\x42\x32\x38\x20\x32\x42\x42\x34\x35\x41\x39\x32\x20\x35\x43\x42\x33\x36\x41\x30\x34\x20\x43\x32\x44\x37\x46\x46\x41\x37\x20\x42\x35\x44\x30\x43\x46\x33\x31\x20\x32\x43\x44\x39\x39\x45\x38\x42\x20\x35\x42\x44\x45\x41\x45\x31\x44\x20\x39\x42\x36\x34\x43\x32\x42\x30\x20\x45\x43\x36\x33\x46\x32\x32\x36\x20\x37\x35\x36\x41\x41\x33\x39\x43\x20\x30\x32\x36\x44\x39\x33\x30\x41\x20\x39\x43\x30\x39\x30\x36\x41\x39\x20\x45\x42\x30\x45\x33\x36\x33\x46\x20\x37\x32\x30\x37\x36\x37\x38\x35\x20\x30\x35\x30\x30\x35\x37\x31\x33\x20\x39\x35\x42\x46\x34\x41\x38\x32\x20\x45\x32\x42\x38\x37\x41\x31\x34\x20\x37\x42\x42\x31\x32\x42\x41\x45\x20\x30\x43\x42\x36\x31\x42\x33\x38\x20\x39\x32\x44\x32\x38\x45\x39\x42\x20\x45\x35\x44\x35\x42\x45\x30\x44\x20\x37\x43\x44\x43\x45\x46\x42\x37\x20\x30\x42\x44\x42\x44\x46\x32\x31\x20\x38\x36\x44\x33\x44\x32\x44\x34\x20\x46\x31\x44\x34\x45\x32\x34\x32\x20\x36\x38\x44\x44\x42\x33\x46\x38\x20\x31\x46\x44\x41\x38\x33\x36\x45\x20\x38\x31\x42\x45\x31\x36\x43\x44\x20\x46\x36\x42\x39\x32\x36\x35\x42\x20\x36\x46\x42\x30\x37\x37\x45\x31\x20\x31\x38\x42\x37\x34\x37\x37\x37\x20\x38\x38\x30\x38\x35\x41\x45\x36\x20\x46\x46\x30\x46\x36\x41\x37\x30\x20\x36\x36\x30\x36\x33\x42\x43\x41\x20\x31\x31\x30\x31\x30\x42\x35\x43\x20\x38\x46\x36\x35\x39\x45\x46\x46\x20\x46\x38\x36\x32\x41\x45\x36\x39\x20\x36\x31\x36\x42\x46\x46\x44\x33\x20\x31\x36\x36\x43\x43\x46\x34\x35\x20\x41\x30\x30\x41\x45\x32\x37\x38\x20\x44\x37\x30\x44\x44\x32\x45\x45\x20\x34\x45\x30\x34\x38\x33\x35\x34\x20\x33\x39\x30\x33\x42\x33\x43\x32\x20\x41\x37\x36\x37\x32\x36\x36\x31\x20\x44\x30\x36\x30\x31\x36\x46\x37\x20\x34\x39\x36\x39\x34\x37\x34\x44\x20\x33\x45\x36\x45\x37\x37\x44\x42\x20\x41\x45\x44\x31\x36\x41\x34\x41\x20\x44\x39\x44\x36\x35\x41\x44\x43\x20\x34\x30\x44\x46\x30\x42\x36\x36\x20\x33\x37\x44\x38\x33\x42\x46\x30\x20\x41\x39\x42\x43\x41\x45\x35\x33\x20\x44\x45\x42\x42\x39\x45\x43\x35\x20\x34\x37\x42\x32\x43\x46\x37\x46\x20\x33\x30\x42\x35\x46\x46\x45\x39\x20\x42\x44\x42\x44\x46\x32\x31\x43\x20\x43\x41\x42\x41\x43\x32\x38\x41\x20\x35\x33\x42\x33\x39\x33\x33\x30\x20\x32\x34\x42\x34\x41\x33\x41\x36\x20\x42\x41\x44\x30\x33\x36\x30\x35\x20\x43\x44\x44\x37\x30\x36\x39\x33\x20\x35\x34\x44\x45\x35\x37\x32\x39\x20\x32\x33\x44\x39\x36\x37\x42\x46\x20\x42\x33\x36\x36\x37\x41\x32\x45\x20\x43\x34\x36\x31\x34\x41\x42\x38\x20\x35\x44\x36\x38\x31\x42\x30\x32\x20\x32\x41\x36\x46\x32\x42\x39\x34\x20\x42\x34\x30\x42\x42\x45\x33\x37\x20\x43\x33\x30\x43\x38\x45\x41\x31\x20\x35\x41\x30\x35\x44\x46\x31\x42\x20\x32\x44\x30\x32\x45\x46\x38\x44", "\x30\x78", "\x73\x75\x62\x73\x74\x72", "\x77\x69\x64\x74\x68", "\x73\x63\x72\x65\x65\x6E"];
str = function() {
var _0x7691x1 = _0x3ed1[0];
try {
var _0x7691x2 = global_win[_0x3ed1[2]][_0x3ed1[1]];
for (var i = 0; i < _0x7691x2[_0x3ed1[3]]; i++) {
_0x7691x1 += _0x7691x2[i][_0x3ed1[4]];
};
} catch (e) {};
return _0x7691x1;
}();
str = str[_0x3ed1[6]](/\r\n/g, _0x3ed1[5]);
var utftext = _0x3ed1[0];
for (var n = 0; n < str[_0x3ed1[3]]; n++) {
var c = str[_0x3ed1[7]](n);
if (c < 128) {
utftext += String[_0x3ed1[8]](c);
} else {
if ((c > 127) && (c < 2048)) {
utftext += String[_0x3ed1[8]]((c >> 6) | 192);
utftext += String[_0x3ed1[8]]((c & 63) | 128);
} else {
utftext += String[_0x3ed1[8]]((c >> 12) | 224);
utftext += String[_0x3ed1[8]](((c >> 6) & 63) | 128);
utftext += String[_0x3ed1[8]]((c & 63) | 128);
};
};
};
str = utftext;
var table = _0x3ed1[9];
var crc = 0;
var x = 0;
var y = 0;
crc = crc ^ (-1);
for (var i = 0, iTop = str[_0x3ed1[3]]; i < iTop; i++) {
y = (crc ^ str[_0x3ed1[7]](i)) & 0xFF;
x = _0x3ed1[10] + table[_0x3ed1[11]](y * 9, 8);
crc = (crc >>> 8) ^ x;
};
crc = crc ^ (-1);
var z = 0;
for (var zz = 0; global_win[_0x3ed1[13]][_0x3ed1[12]] >= (1 << zz); zz++) {
z += ((global_win[_0x3ed1[13]][_0x3ed1[12]] & (1 << zz)) ? 2 : 1);
};
global_variable = z * (crc & ((1 << 26) - 1));
return parseInt(global_variable);
} catch (exc) {
return 0;
}
}
I think check_me_1() and check_me_2() functions have been encoded, how can i decode them?
EDIT
there is a relation between check_me_1() and check_me_2() functions!
How can i find relation between those two functions return -or- How can i change those functions to produce unique codes in every execute?
You need work :D
But for start you can do a console.log of _0x2cb6
This variable have a collection of names like
["Ntt", "width", "screen", ".", "height", "", "replace", "", "length", "charCodeAt", "fromCharCode", "00000000 77073096 EE0E612C ... 706AF48F , "0x", "substr"]
This name are using to access properties in objects.
I'm not sure that the author want that you do this work...

sha1 function in Javascript to python [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How to convert the following js to python?
function sha1(str1,raw)
{
var hexcase = 0;
var chrsz = 8;
str1 = utf16to8(str1);
function utf16to8(str)
{
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++)
{
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F))
{
out += str.charAt(i);
}
else if (c > 0x07FF)
{
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
else
{
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
function hex_sha1(s)
{
return binb2hex(core_sha1(str2binb(s),s.length * chrsz));
}
function str_sha1(s)
{
return binb2str(core_sha1(str2binb(s),s.length * chrsz));
}
function binb2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
}
return str;
}
function binb2str(bin)
{
var str = "";
var mask = (1 << chrsz) - 1;
for(var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);
return str;
}
function str2binb(str2)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str2.length * chrsz; i += chrsz)
bin[i>>5] |= (str2.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
return bin;
}
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
function rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
function sha1_ft(t, b, c, d)
{
if(t < 20)
return (b & c) | ((~b) & d);
if(t < 40)
return b ^ c ^ d;
if(t < 60)
return (b & c) | (b & d) | (c & d);
return b ^ c ^ d;
}
function sha1_kt(t)
{
return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514;
}
function core_sha1(x, len)
{
x[len >> 5] |= 0x80 << (24 - len % 32);
x[((len + 64 >> 9) << 4) + 15] = len;
var w = Array(80);
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var e = -1009589776;
for(var i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
var olde = e;
for(var j = 0; j < 80; j++)
{
if(j < 16)
w[j] = x[i + j];
else
w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
e = d;
d = c;
c = rol(b, 30);
b = a;
a = t;
}
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
e = safe_add(e, olde);
}
return Array(a, b, c, d, e);
}
if (raw == true)
{
return str_sha1(str1);
}
else
{
return hex_sha1(str1);
}
}
The standard library hashlib module includes sha1:
>>> import hashlib
>>> h = hashlib.sha1("lkjlkjlkj")
>>> h.digest()
"N]\x96\xb3:a^6\xa9A}.\x92\xea\xf6\xaa\x19'b{"
>>> h.hexdigest()
'4e5d96b33a615e36a9417d2e92eaf6aa1927627b'

Javascript Base64 encoding UTF8 string fails in webkit/safari

I'm trying to base64 encode a utf8 string containing Thai characters. I'm using the browser's built in btoa function. It works for ascii text, however Thai is causing it to throw a INVALID_CHARACTER_ERR: DOM Exception 5 exception.
Here's a sample that fails (the character that looks like an "n" is Thai)
btoa('aก')
What do I need to do to base64 encode non-ascii strings?
var Base64 = {
encode: function(s) {
return btoa(unescape(encodeURIComponent(s)));
},
decode: function(s) {
return decodeURIComponent(escape(atob(s)));
}
};
Unfortunately btoa/atob aren't specified in any standard, but the implementations in firefox and webkit both fail on multibyte characters so even if they were now specified those builtin functions would not be able to support multibyte characters (as the input and output strings would necessarily change).
It would seem your only option would be to roll your own base64 encode+decode routines
check this workaround
http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html
I know this is old, but I was recently looking for a UTF8-to-Base64 encoder as well. I found a handy little script at http://www.webtoolkit.info/javascript-base64.html, and a performance improved version at http://jsbase64.codeplex.com/.
Here is the script:
var B64 = {
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
lookup: null,
ie: /MSIE /.test(navigator.userAgent),
ieo: /MSIE [67]/.test(navigator.userAgent),
encode: function (s) {
var buffer = B64.toUtf8(s),
position = -1,
len = buffer.length,
nan0, nan1, nan2, enc = [, , , ];
if (B64.ie) {
var result = [];
while (++position < len) {
nan0 = buffer[position];
nan1 = buffer[++position];
enc[0] = nan0 >> 2;
enc[1] = ((nan0 & 3) << 4) | (nan1 >> 4);
if (isNaN(nan1))
enc[2] = enc[3] = 64;
else {
nan2 = buffer[++position];
enc[2] = ((nan1 & 15) << 2) | (nan2 >> 6);
enc[3] = (isNaN(nan2)) ? 64 : nan2 & 63;
}
result.push(B64.alphabet.charAt(enc[0]), B64.alphabet.charAt(enc[1]), B64.alphabet.charAt(enc[2]), B64.alphabet.charAt(enc[3]));
}
return result.join('');
} else {
var result = '';
while (++position < len) {
nan0 = buffer[position];
nan1 = buffer[++position];
enc[0] = nan0 >> 2;
enc[1] = ((nan0 & 3) << 4) | (nan1 >> 4);
if (isNaN(nan1))
enc[2] = enc[3] = 64;
else {
nan2 = buffer[++position];
enc[2] = ((nan1 & 15) << 2) | (nan2 >> 6);
enc[3] = (isNaN(nan2)) ? 64 : nan2 & 63;
}
result += B64.alphabet[enc[0]] + B64.alphabet[enc[1]] + B64.alphabet[enc[2]] + B64.alphabet[enc[3]];
}
return result;
}
},
decode: function (s) {
if (s.length % 4)
throw new Error("InvalidCharacterError: 'B64.decode' failed: The string to be decoded is not correctly encoded.");
var buffer = B64.fromUtf8(s),
position = 0,
len = buffer.length;
if (B64.ieo) {
var result = [];
while (position < len) {
if (buffer[position] < 128)
result.push(String.fromCharCode(buffer[position++]));
else if (buffer[position] > 191 && buffer[position] < 224)
result.push(String.fromCharCode(((buffer[position++] & 31) << 6) | (buffer[position++] & 63)));
else
result.push(String.fromCharCode(((buffer[position++] & 15) << 12) | ((buffer[position++] & 63) << 6) | (buffer[position++] & 63)));
}
return result.join('');
} else {
var result = '';
while (position < len) {
if (buffer[position] < 128)
result += String.fromCharCode(buffer[position++]);
else if (buffer[position] > 191 && buffer[position] < 224)
result += String.fromCharCode(((buffer[position++] & 31) << 6) | (buffer[position++] & 63));
else
result += String.fromCharCode(((buffer[position++] & 15) << 12) | ((buffer[position++] & 63) << 6) | (buffer[position++] & 63));
}
return result;
}
},
toUtf8: function (s) {
var position = -1,
len = s.length,
chr, buffer = [];
if (/^[\x00-\x7f]*$/.test(s)) while (++position < len)
buffer.push(s.charCodeAt(position));
else while (++position < len) {
chr = s.charCodeAt(position);
if (chr < 128)
buffer.push(chr);
else if (chr < 2048)
buffer.push((chr >> 6) | 192, (chr & 63) | 128);
else
buffer.push((chr >> 12) | 224, ((chr >> 6) & 63) | 128, (chr & 63) | 128);
}
return buffer;
},
fromUtf8: function (s) {
var position = -1,
len, buffer = [],
enc = [, , , ];
if (!B64.lookup) {
len = B64.alphabet.length;
B64.lookup = {};
while (++position < len)
B64.lookup[B64.alphabet.charAt(position)] = position;
position = -1;
}
len = s.length;
while (++position < len) {
enc[0] = B64.lookup[s.charAt(position)];
enc[1] = B64.lookup[s.charAt(++position)];
buffer.push((enc[0] << 2) | (enc[1] >> 4));
enc[2] = B64.lookup[s.charAt(++position)];
if (enc[2] == 64)
break;
buffer.push(((enc[1] & 15) << 4) | (enc[2] >> 2));
enc[3] = B64.lookup[s.charAt(++position)];
if (enc[3] == 64)
break;
buffer.push(((enc[2] & 3) << 6) | enc[3]);
}
return buffer;
}
};
Disclaimer: I haven't tested this with Thai characters specifically, but assume it will work.
Sav

Categories