- Home /
Javascript/Unityscript or c# String obfuscator ...
I guess this is not 100.0% Unity related ..
I just need a U/S (javascript is close enough) or c#
routine that will take a long String and un / obfuscate it.
(TBC I do not mean source code ... just a simple long String, likely the contents of a simple text file.)
So,
var xx:String = someTextAsset.text;
var clear:String = _handyRoutine( xx );
So, it could encrypt it in a simple way or otherwise mash it up, and then unmash it.
I am not a regular javasript/c# programmer so i don't know all the secret stashes you guys know.
(Something may already exist in .NET for all I know.)
Does anyone have a reliable one on hand ? Thanks a million!!!
Answer by ryba · Jan 23, 2013 at 02:05 PM
http://stackoverflow.com/questions/165808/simple-2-way-encryption-for-c-sharp
You can just save class provided by Mark Brittingham in your unity scripts, and use it for encrypting / decrypting your strings, but its only C# solution. Im not sure if you can use it in javascript, but propably you could, since C# is compiled before javascripts (i think so). Its worth try though
thanks a lot for that
it's a hell of a shame to use something as big as System.Security.Cryptography just for a little text obfuscation though !
Sigh !
It depends on how often you need to encrypt strings. If you wont do that hundreds of thousands times per Update it wont be any problem then.
sure, I just meant it's a shame to add the library to the build.
again, thanks for the very valuable pointer - cheers
Answer by darkhog · Jan 23, 2013 at 04:52 PM
If you want to obfuscate strings so no one can read them, I think best way would be to convert them to arrays of ints that contains Unicode values for each character and then do function that would take such array and decode it into string. You could also use some simple encryption on it like xoring or rot13.
Right, something as simple as XORing (or even rot13) would be fine --
but you'd think somewhere there'd be a simple ready-to-use system laying around, that carefully takes care of making text safe, keeping it in a form you can save as ascii, etc etc.
Your answer
Follow this Question
Related Questions
Detect Text in GUI; Print 1 Answer
GUIText only appearing in Unity Simlutor, but not actual iPad..why? 0 Answers
The gui disappears when i let go 2 Answers
How to populate an array from an external text file 1 Answer
Adding Names 1 Answer