Live data from Hacker News

A technique for hiding your JavaScript code

patrick-wied.at

11–20 of 36 posts

Re: A technique for hiding your JavaScript code

#12
post #8

I can't help but feel saddened that we learned how to code using View Source (indeed, it's a big factor in the web's success) and now we're trying to prevent others doing the same. Also, this seems like a surprisingly naive generalisation to me: "... a first measurement for preventing evil business guys from stealing your code – developers who can figure the code out are (mostly) kind enough not to steal it."

"Developer tools" is the new View Source. Browsers should really just redirect View Source to the live DOM view of their developer tools, that's what most people want from it.

Re: A technique for hiding your JavaScript code

#15
post #8

I can't help but feel saddened that we learned how to code using View Source (indeed, it's a big factor in the web's success) and now we're trying to prevent others doing the same. Also, this seems like a surprisingly naive generalisation to me: "... a first measurement for preventing evil business guys from stealing your code – developers who can figure the code out are (mostly) kind enough not to steal it."

"Developer tools" is the new View Source. Browsers should really just redirect View Source to the live DOM view of their developer tools, that's what most people want from it.

Maybe, but there's still a lot of value in being able to see pre-rendered code so I wouldn't go as far as a redirect. Somehow combining the two could be a good option.

Re: A technique for hiding your JavaScript code

#16
post #10

This is a really good Idea! I will implement this in my site, where I blocked the right mouse-klick so nobody can steal my images!!11

Dude, you are kidding, right? I hope so.

The "11" at the end indicates that he is indeed kidding.

Re: A technique for hiding your JavaScript code

#17
post #2

Bonus points for not just creating an image, but hiding the code steganographically in an existing image (ie only using the LSB of each pixel to hide code)!

Comments should make it fairly straightforward to accomplish:

function foo() {

/* ...characters for image data... /

bar();

/ ...more image data... */

The asterisks are not showing up but you get the idea. It checks out with the comments part of the javascript spec as well:

http://ecma-international.org/ecma-262/5.1/#sec-7.4

...as the text inside the comment can be any unicode code unit except for an asterisk (For source Character rules see http://ecma-international.org/ecma-262/5.1/#sec-6).

Re: A technique for hiding your JavaScript code

#20
post #2

Bonus points for not just creating an image, but hiding the code steganographically in an existing image (ie only using the LSB of each pixel to hide code)!

This might be quite effective in preventing people trying to reveal your code as part of their job. You could use some sort of obscene image to hide your code in.

But at some point you need to have the code on client side to get the code in string format, doesn't that give away how you've stored the code in the image?
Post reply on HN