Jump to content
  • Advertisement
Sign in to follow this  

Obfuscated Ruby Code...

This topic is 4711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it true that ruby can be obfuscated? o_O Also, is it possible to pack image files, and sound files, and other files all into 1 file, but still be able to run the code? Thanks.

Share this post

Link to post
Share on other sites
For your second question, you can do that with resources in EXEs (under Windows) and possibly with Makeself (under Unix), although I have yet to test my theory.

As for your first question, I suspect Ruby's syntax is too clean to allow advanced obfuscation like you can get with C and Perl...


Share this post

Link to post
Share on other sites
The most obfuscated I could get with it is the following:

index.puts("[blist"+(`ls #$wikidir/pages`.grep(/^#{letter}/).\ map{|s|s.chomp.gsub(/\.\d+$/,'')}.uniq+File.read("#$wikidir/gend").\ grep(/^#{letter}/).map{|s|s.gsub(/:.*/,'')}).sort.\ map{|el| "[item #{el}]"}.join+']')

I have an 8 line comment to explain to myself what it does.
Probably not nearly as obfuscated, as fyhuang said, as C or perl could get.

edit: wrote code instead of source
edit 2: it ate my backslashes
edit 3: removed the source tag to try to get it to stop eating the backslash newlines
edit 4: double the backslashes. If this doesn't work, at least I tried.

Share this post

Link to post
Share on other sites
I posted this entry to the IORCC (International Obfsucated Ruby Code Contest):

a.transpose.each{ |a|
|i|print i==49?

Obfuscated enough for you? :)

Edit: The board software removed three important back slashes.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!