Google and obfuscation

A

artistography

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!
 
D

David Dorward

If obfuscation isn't all that good, why does Google obfuscate its
search results' code?

They don't. They just don't output lots of whitespace to make their
code more readable.
Could anyone out there decipher and normalize code for a Google search
result page?

Any DOM inspector (such as the one in Firebug) or HTML Tidy should do
the job.
 
J

jeckab612

They don't. They just don't output lots of whitespace to make their
code more readable.


Any DOM inspector (such as the one in Firebug) or HTML Tidy should do
the job.

Of course they do. Anyone having tried to read their javascript code
wouldn't ever say they don't obfuscate it. There are several reasons
for such thing, and of course that's not bad - they hide their code
(not because in such way you can't steal it, although they get that
too, but because they make it more difficult for users to try to use
it against their security), and second - they make their code smaller,
thus faster for Internet transmission - for someone having a decent
connection, that's not much, but Google gets tens of thousands hits
per second, so it's important to minimize transport load.

As for how they do it - that's really not so hard, you can easily make
a C program to obfuscate javascript easily just by replacing all the
non-keywords with a, b, c, ... z, a1, a2, ... so the code is smaller,
plus you can delete all necessary white space, and that's it.
 
J

jeckab612

Could anyone out there decipher and normalize code for a Google search
result page?
Maybe if you tried, but hardly. You can indent the code, but would you
ever be able to decipher a code like this:
if ( a && ! b )
c( x1, x3, l ) || d( x1, ! x3, l );

? And remember, there's like 900k of such code for just gmail.

And despite the obfuscation, why is Google so fast?
Too big question, it's least affected by their js code, but rather by
their servers' strength, and mostly good algorithms in searching
results, caching, distributing requests to different machines etc..
 
D

dreamznatcher

Of course they do. Anyone having tried to read their javascript code
wouldn't ever say they don't obfuscate it. There are several reasons
for such thing, and of course that's not bad - they hide their code
(not because in such way you can't steal it, although they get that
too, but because they make it more difficult for users to try to use
it against their security), and second - they make their code smaller,
thus faster for Internet transmission - for someone having a decent
connection, that's not much, but Google gets tens of thousands hits
per second, so it's important to minimize transport load.

As for how they do it - that's really not so hard, you can easily make
a C program to obfuscate javascript easily just by replacing all the
non-keywords with a, b, c, ... z, a1, a2, ... so the code is smaller,
plus you can delete all necessary white space, and that's it.

Thanks. Ahem, not really much into C.. could you point me towards an
existing C program that does this? Now I think I could handle
understanding that from there.
 
D

dreamznatcher

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!

Thanks to everyone who've posted replies. I really appreciate it. Now,
here's some code from a Google search result page:

< script ><!-- (function() {
window.google = {
kEI: "SRhbRoOdH6GesAKi98mnBQ",
kEXPI: "17050,17469",
kHL: "en"
};
})
(); (function() {
window.ss = function() {
window.status = "";
return true
};
})
(); (function() {
window.rwt = function(b, d, f, j, k, g, l) {
var a = window.encodeURIComponent ? encodeURIComponent:
escape,
h = "",
i = "",
c = b.href.split("#"),
e = "";
if (d) {
h = "&oi=" + a(d)
}
if (f) {
i = "&cad=" + a(f)
}
if (g) {
e = "&usg=" + g
}
b.href = "/url ? sa = t " + h + i + " & ct = " + a(j) + " & cd
= " + a(k) + " & url = " + a(c[0]).replace(/\+/g, " % 2B ") + " & ei =
SRhbRoOdH6GesAKi98mnBQ " + e + l + (c[1] ? " # " + c[1]: "");
b.onmousedown = "";
return true
};
})
();
window.gbar = {}; (function() {
function n(a, b, c) {
var e = "on " + b;
if (a.addEventListener) {
a.addEventListener(b, c, false)
} else if (a.attachEvent) {
a.attachEvent(e, c)
} else {
var d = a[e];
a[e] = function() {
var f = d.apply(this, arguments),
g = c.apply(this, arguments);
return f == undefined ? g: (g == undefined ? f: g &&
f)
}
}
};
var h = window.gbar,
l = ["affdom ", "channel ", "client ", "hl ", "hs ", "ie ", "lr ",
"ned ", "oe ", "og ", "rls ", "rlz "];
function i(a) {
return a == "c " || a == "o " || a == "m "
}
h.getHtml = function(a) {
var b;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][2] == "") {
b = a[c][0]
}
}
var e = i(b) ? "target = _blank ": "",
d = " < td nowrap > ",
f = " < table border = 0 cellpadding = 0 cellspacing = 0 style
= margin - left: " + h.getPad(true) + "px >< tr > " + d;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][0] == b) {
f += a[c][1].bold() + d
} else {
f += " < a href = ";
if (a[c][3] == 3) {
f += '# onclick="this.blur();return
gbar.toggle(event)" style=text-decoration:none' + e + " >< u > " + a[c]
[1] + " < /u> <span style=font-size:11px>▼</span >< /a><tr><td
colspan=" + c + "><td><iframe class=gbard id=gbarif style=border:0;z-
index:999></iframe >< div class = gbard id = gbardd onclick =
gbar.stopB(event) > ";
d = ""
} else {
f += m(b, a[c][0], a[c][2]) + e + "onclick =
gbar.close(event) > " + a[c][1] + " < /a>" + d
}
}
}
f += "</div >< /table>";
return f
};
h.getPad = function(a) {
var b =- 1,
c = a ? 10: 4,
e = document.body.currentStyle,
d = document.defaultView;
if (e) {
b = a ? e.marginLeft: e.marginTop
} else if (d) {
b = a ? d.getComputedStyle(document.body, "").marginLeft:
d.getComputedStyle(document.body, "").marginTop
}
b = parseInt(b, 10);
return b >= 0 && b < c ? c - b: 1
};
function m(a, b, c) {
var e = window.location.search.substring(1),
d = e.match("q=[^&]*"),
f = e.match("near=([^&]*)"),
g = c + (c.match("[?]") ? "&": "?");
g += "tab=" + a + b;
if (i(b) && window.location.protocol == "https:") {
g = g.replace("http:", "https:")
}
if ( ! i(b) &&! i(a)) {
for (var j = 0; j < l.length; j ++ ) {
var k = e.match(l[j] + "=[^&]*");
if (k) {
g += "&" + k[0]
}
}
if (d && f && a == "l" && b != "l") {
g += "&" + d[0] + "+" + f[0]
} else if (d) {
g += "&" + d[0]
}
}
return g
}
h.toggle = function(a) {
h.stopB(a);
var b = document.getElementById("gbardd"),
c = document.getElementById("gbarif");
if (b && c) {
b.style.display = b.style.display == "block" ? "none":
"block";
c.width = b.offsetWidth;
c.height = b.offsetHeight;
c.style.display = b.style.display
}
return false
};
h.close = function(a) {
var b = document.getElementById("gbardd");
if (b && b.style.display == "block") {
h.toggle(a)
}
};
h.stopB = function(a) {
if ( ! a) {
a = window.event
}
a.cancelBubble = true
};
n(document, "click", h.close);
})
();
/ / -->< /script>/

I'm not really an expert in JavaScript (and neither do I have any
intentions of pilfering Google code). But for educational purposes
only, could someone out there please explain these lines of code? I
know all this is really taxing and thanks in advance..

Secondly, no one really answered the bit on the thumbnail part... on
how on-the-fly thumbnails seem to be done better in Google Images or
Facebook..

Finally (for now), does anyone know how to design Unicode fonts? The
Unicode groups on Usenet don't really seem that inviting so I'm
posting this here.

Once again, thanks in advance for everything.
 
D

dreamznatcher

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!

Thanks to everyone who've posted replies. I really appreciate it. Now,
here's some code from a Google search result page:

< script ><!-- (function() {
window.google = {
kEI: "SRhbRoOdH6GesAKi98mnBQ",
kEXPI: "17050,17469",
kHL: "en"
};
})
(); (function() {
window.ss = function() {
window.status = "";
return true
};
})
(); (function() {
window.rwt = function(b, d, f, j, k, g, l) {
var a = window.encodeURIComponent ? encodeURIComponent:
escape,
h = "",
i = "",
c = b.href.split("#"),
e = "";
if (d) {
h = "&oi=" + a(d)
}
if (f) {
i = "&cad=" + a(f)
}
if (g) {
e = "&usg=" + g
}
b.href = "/url ? sa = t " + h + i + " & ct = " + a(j) + " & cd
= " + a(k) + " & url = " + a(c[0]).replace(/\+/g, " % 2B ") + " & ei =
SRhbRoOdH6GesAKi98mnBQ " + e + l + (c[1] ? " # " + c[1]: "");
b.onmousedown = "";
return true
};
})
();
window.gbar = {}; (function() {
function n(a, b, c) {
var e = "on " + b;
if (a.addEventListener) {
a.addEventListener(b, c, false)
} else if (a.attachEvent) {
a.attachEvent(e, c)
} else {
var d = a[e];
a[e] = function() {
var f = d.apply(this, arguments),
g = c.apply(this, arguments);
return f == undefined ? g: (g == undefined ? f: g &&
f)
}
}
};
var h = window.gbar,
l = ["affdom ", "channel ", "client ", "hl ", "hs ", "ie ", "lr ",
"ned ", "oe ", "og ", "rls ", "rlz "];
function i(a) {
return a == "c " || a == "o " || a == "m "
}
h.getHtml = function(a) {
var b;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][2] == "") {
b = a[c][0]
}
}
var e = i(b) ? "target = _blank ": "",
d = " < td nowrap > ",
f = " < table border = 0 cellpadding = 0 cellspacing = 0 style
= margin - left: " + h.getPad(true) + "px >< tr > " + d;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][0] == b) {
f += a[c][1].bold() + d
} else {
f += " < a href = ";
if (a[c][3] == 3) {
f += '# onclick="this.blur();return
gbar.toggle(event)" style=text-decoration:none' + e + " >< u > " + a[c]
[1] + " < /u> <span style=font-size:11px>▼</span >< /a><tr><td
colspan=" + c + "><td><iframe class=gbard id=gbarif style=border:0;z-
index:999></iframe >< div class = gbard id = gbardd onclick =
gbar.stopB(event) > ";
d = ""
} else {
f += m(b, a[c][0], a[c][2]) + e + "onclick =
gbar.close(event) > " + a[c][1] + " < /a>" + d
}
}
}
f += "</div >< /table>";
return f
};
h.getPad = function(a) {
var b =- 1,
c = a ? 10: 4,
e = document.body.currentStyle,
d = document.defaultView;
if (e) {
b = a ? e.marginLeft: e.marginTop
} else if (d) {
b = a ? d.getComputedStyle(document.body, "").marginLeft:
d.getComputedStyle(document.body, "").marginTop
}
b = parseInt(b, 10);
return b >= 0 && b < c ? c - b: 1
};
function m(a, b, c) {
var e = window.location.search.substring(1),
d = e.match("q=[^&]*"),
f = e.match("near=([^&]*)"),
g = c + (c.match("[?]") ? "&": "?");
g += "tab=" + a + b;
if (i(b) && window.location.protocol == "https:") {
g = g.replace("http:", "https:")
}
if ( ! i(b) &&! i(a)) {
for (var j = 0; j < l.length; j ++ ) {
var k = e.match(l[j] + "=[^&]*");
if (k) {
g += "&" + k[0]
}
}
if (d && f && a == "l" && b != "l") {
g += "&" + d[0] + "+" + f[0]
} else if (d) {
g += "&" + d[0]
}
}
return g
}
h.toggle = function(a) {
h.stopB(a);
var b = document.getElementById("gbardd"),
c = document.getElementById("gbarif");
if (b && c) {
b.style.display = b.style.display == "block" ? "none":
"block";
c.width = b.offsetWidth;
c.height = b.offsetHeight;
c.style.display = b.style.display
}
return false
};
h.close = function(a) {
var b = document.getElementById("gbardd");
if (b && b.style.display == "block") {
h.toggle(a)
}
};
h.stopB = function(a) {
if ( ! a) {
a = window.event
}
a.cancelBubble = true
};
n(document, "click", h.close);
})
();
/ / -->< /script>/

I'm not really an expert in JavaScript (and neither do I have any
intentions of pilfering Google code). But for educational purposes
only, could someone out there please explain these lines of code? I
know all this is really taxing and thanks in advance..

Secondly, no one really answered the bit on the thumbnail part... on
how on-the-fly thumbnails seem to be done better in Google Images or
Facebook..

Finally (for now), does anyone know how to design Unicode fonts? The
Unicode groups on Usenet don't really seem that inviting so I'm
posting this here.

Once again, thanks in advance for everything.
 
D

dreamznatcher

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!

Hello,
I was wondering:

If obfuscation isn't all that good, why does Google obfuscate its
search results' code? Okay, I realize they're a commercial entity and
need to do it. How do they do it?

Could anyone out there decipher and normalize code for a Google search
result page? And despite the obfuscation, why is Google so fast?

I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!

Thanks to everyone who've posted replies. I really appreciate it. Now,
here's some code from a Google search result page:

< script ><!-- (function() {
window.google = {
kEI: "SRhbRoOdH6GesAKi98mnBQ",
kEXPI: "17050,17469",
kHL: "en"
};
})
(); (function() {
window.ss = function() {
window.status = "";
return true
};
})
(); (function() {
window.rwt = function(b, d, f, j, k, g, l) {
var a = window.encodeURIComponent ? encodeURIComponent:
escape,
h = "",
i = "",
c = b.href.split("#"),
e = "";
if (d) {
h = "&oi=" + a(d)
}
if (f) {
i = "&cad=" + a(f)
}
if (g) {
e = "&usg=" + g
}
b.href = "/url ? sa = t " + h + i + " & ct = " + a(j) + " & cd
= " + a(k) + " & url = " + a(c[0]).replace(/\+/g, " % 2B ") + " & ei =
SRhbRoOdH6GesAKi98mnBQ " + e + l + (c[1] ? " # " + c[1]: "");
b.onmousedown = "";
return true
};
})
();
window.gbar = {}; (function() {
function n(a, b, c) {
var e = "on " + b;
if (a.addEventListener) {
a.addEventListener(b, c, false)
} else if (a.attachEvent) {
a.attachEvent(e, c)
} else {
var d = a[e];
a[e] = function() {
var f = d.apply(this, arguments),
g = c.apply(this, arguments);
return f == undefined ? g: (g == undefined ? f: g &&
f)
}
}
};
var h = window.gbar,
l = ["affdom ", "channel ", "client ", "hl ", "hs ", "ie ", "lr ",
"ned ", "oe ", "og ", "rls ", "rlz "];
function i(a) {
return a == "c " || a == "o " || a == "m "
}
h.getHtml = function(a) {
var b;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][2] == "") {
b = a[c][0]
}
}
var e = i(b) ? "target = _blank ": "",
d = " < td nowrap > ",
f = " < table border = 0 cellpadding = 0 cellspacing = 0 style
= margin - left: " + h.getPad(true) + "px >< tr > " + d;
for (var c = 0; c < a.length; c ++ ) {
if (a[c][0] == b) {
f += a[c][1].bold() + d
} else {
f += " < a href = ";
if (a[c][3] == 3) {
f += '# onclick="this.blur();return
gbar.toggle(event)" style=text-decoration:none' + e + " >< u > " + a[c]
[1] + " < /u> <span style=font-size:11px>▼</span >< /a><tr><td
colspan=" + c + "><td><iframe class=gbard id=gbarif style=border:0;z-
index:999></iframe >< div class = gbard id = gbardd onclick =
gbar.stopB(event) > ";
d = ""
} else {
f += m(b, a[c][0], a[c][2]) + e + "onclick =
gbar.close(event) > " + a[c][1] + " < /a>" + d
}
}
}
f += "</div >< /table>";
return f
};
h.getPad = function(a) {
var b =- 1,
c = a ? 10: 4,
e = document.body.currentStyle,
d = document.defaultView;
if (e) {
b = a ? e.marginLeft: e.marginTop
} else if (d) {
b = a ? d.getComputedStyle(document.body, "").marginLeft:
d.getComputedStyle(document.body, "").marginTop
}
b = parseInt(b, 10);
return b >= 0 && b < c ? c - b: 1
};
function m(a, b, c) {
var e = window.location.search.substring(1),
d = e.match("q=[^&]*"),
f = e.match("near=([^&]*)"),
g = c + (c.match("[?]") ? "&": "?");
g += "tab=" + a + b;
if (i(b) && window.location.protocol == "https:") {
g = g.replace("http:", "https:")
}
if ( ! i(b) &&! i(a)) {
for (var j = 0; j < l.length; j ++ ) {
var k = e.match(l[j] + "=[^&]*");
if (k) {
g += "&" + k[0]
}
}
if (d && f && a == "l" && b != "l") {
g += "&" + d[0] + "+" + f[0]
} else if (d) {
g += "&" + d[0]
}
}
return g
}
h.toggle = function(a) {
h.stopB(a);
var b = document.getElementById("gbardd"),
c = document.getElementById("gbarif");
if (b && c) {
b.style.display = b.style.display == "block" ? "none":
"block";
c.width = b.offsetWidth;
c.height = b.offsetHeight;
c.style.display = b.style.display
}
return false
};
h.close = function(a) {
var b = document.getElementById("gbardd");
if (b && b.style.display == "block") {
h.toggle(a)
}
};
h.stopB = function(a) {
if ( ! a) {
a = window.event
}
a.cancelBubble = true
};
n(document, "click", h.close);
})
();
/ / -->< /script>/

I'm not really an expert in JavaScript (and neither do I have any
intentions of pilfering Google code). But for educational purposes
only, could someone out there please explain these lines of code? I
know all this is really taxing and thanks in advance..

Secondly, no one really answered the bit on the thumbnail part... on
how on-the-fly thumbnails seem to be done better in Google Images or
Facebook..

Finally (for now), does anyone know how to design Unicode fonts? The
Unicode groups on Usenet don't really seem that inviting so I'm
posting this here.

Once again, thanks in advance for everything.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top