By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,526 Members | 2,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,526 IT Pros & Developers. It's quick & easy.

Google and obfuscation

P: n/a
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!

May 27 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On May 27, 8:14 pm, artistogra...@gmail.com wrote:
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.
May 27 '07 #2

P: n/a
On May 27, 9:22 pm, David Dorward <dorw...@gmail.comwrote:
On May 27, 8:14 pm, artistogra...@gmail.com wrote:
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.
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.

May 27 '07 #3

P: n/a
artistogra...@gmail.com wrote:
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..
I also get the feeling sites like Google and Facebook manage to create
better thumbnails on the fly. Any idea how?

Thanks!
May 27 '07 #4

P: n/a
ar***********@gmail.com wrote:
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!
Just a small reply to the question of why Google is so fast.

They distribute the process of generating the page to different servers.
For example when you perform a search Google sends the search string to
their index server, as well as they send the search string to a spell
checking server, and then the same string is sent to their Ad server.
Then the main portal composes all this information into one page. By
distributing the process to various servers you take advantage of the
resources, therefore yielding faster results.

Its practically distributed computing per se.

Hope this helps.

Adonis
May 28 '07 #5

P: n/a
On May 27, 1:14 pm, artistogra...@gmail.com wrote:
Could anyone out there decipher and normalize code for a Google search
result page?
http://elfz.laacz.lv/beautify/

May 28 '07 #6

P: n/a
On May 28, 2:27 am, jeckab...@gmail.com wrote:
On May 27, 9:22 pm, David Dorward <dorw...@gmail.comwrote:
On May 27, 8:14 pm, artistogra...@gmail.com wrote:
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.

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.

May 28 '07 #7

P: n/a
On May 28, 1:14 am, artistogra...@gmail.com wrote:
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!
On May 28, 1:14 am, artistogra...@gmail.com wrote:
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.

May 28 '07 #8

P: n/a
On May 28, 1:14 am, artistogra...@gmail.com wrote:
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!
On May 28, 1:14 am, artistogra...@gmail.com wrote:
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.

May 28 '07 #9

P: n/a
On May 28, 1:14 am, artistogra...@gmail.com wrote:
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!
On May 28, 1:14 am, artistogra...@gmail.com wrote:
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.

May 28 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.