Another option would be to read your sensitive information from a dot
file that is located elsewhere and have your script read that in from
there. That way, you can share your script without having your password
in it.
Encrypt the password?
Remove it from their version of the script if you don’t want someone
else to access it?
Don’t give the script to someone if they lack authorisation to see the
password?
If an exe is your only hope then I think that can only be done on
Windows at present.
Look up the gem “crypt19”. It’s a nifty encryption tool that you can use
by inputting a unique key. It’ll turn your password into a string that
is meaningless until you run the code to decrypt it.
Of course, with an rb file, anyone with the string and the passkey could
decrypt it, but if that’s a worry you shouldn’t be packaging your
password into the script in the first place.
Another option would be to read your sensitive information from a dot
file that is located elsewhere and have your script read that in from
there. That way, you can share your script without having your password
in it.
If someone wants it badly enough (say, to run it in a debugger) there’s
not a lot you can do.
We used to do a few things back in the bad old days.
Break up the password and put it in different fields/variables/array
positions and assemble it at runtime. ( x = a + f + w + otherclass.y
etc.)
XOR it with something simple and unwrap when needed.
Combine the two if you care. You can create as many shells of this kind
of silliness as you want, but frankly, it’s faster to break than it is
to hide, so if you only want to hide it from people scanning through a
hex editor or running strings, I wouldn’t do much beyond step 1.
What is the password protecting? Is it an anti-piracy measure or an
authentication token?
-a.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.