From: Robert Klemme Date: 2004-06-02T16:38:41+09:00 Subject: Re: Obfuscating Ruby Code. "Bill Kelly" schrieb im Newsbeitrag news:004b01c44850$ebe89b90$6442a8c0@musicbox... > Hi, > > From: "Gregory Millam" > > > > How does obfuscating solve your problem? How is that even > > a problem? Just include a compiled ruby interpreter for > > your target platform, and have a link in your code that > > says "For more info about ruby and to download the > > interpreter, go to www.ruby-lang.org" ... > > > > Obfuscaters serve no real use - as long as somebody can pass > > your code through a lexer, it's instantly unobfuscated. > > I imagine the obfuscation would include translation of once- > meaningful identifiers (variable names, method names, ...) > into meaningless gibberish. A lexer would not help much there. > > Such an obfuscator sounds really tough to write for Ruby > though... I presume the string form of eval() would have > to be disallowed from referring to any code subject to > obfuscation... Yes indeed. I harvest a slight doubt that this is possible in Ruby - at least it's an order of magnitude more difficult than for other languages: you need to take into consideration - singleton methods - the eval family of methods - loaded modules - ObjectSpace - implicit conversions (you don't want to change the name of #to_s or #coerce) - dynamic mixins - ... This will make it very hard to decide whether a given identifier (aka constant) can safely be replaced by an obfuscated constant and which constant to use. > I would be very interested in a working Ruby code obfuscator, > even given certain restrictions like that. I'm writing an > application in Ruby that will likely be heavily pirated, like > a video game, as soon as a cracked copy of it becomes > available. As with video games, which i used to do for about > 9 years professionally, we're just trying to delay the time it > takes for someone to produce a cracked version. At least, > I'm presuming anyone needing a Ruby code obfuscator is probably > coming from the same situation. That's why I'd like one anyway. > I'm developing in Ruby because I want to add features faster > than the competition. (Not to mention how much fun programming > in Ruby is. :) But I've gone into writing this app in Ruby > knowing I'm going to need *some* solution to delaying the > (inevitable) appearance of a cracked version of my app. So I'm > very glad to hear Ken is working on such a technology, and > grateful he'd be willing to share it. Maybe your best bet is to encrypt all source code with a public keys and create a compiled Ruby interpreter that decrypts code with a private key when reading a file. That way others could use CryptRuby(TM) also. A slight disadvantage is, that you need to keep the sources to yourself, thus becoming the only source of compiled interpreters for that Ruby variant... Kind regards robert