Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Fattie · Jan 23, 2013 at 01:52 PM · javascripttextstringobfuscation

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!!!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

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

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Jan 24, 2013 at 08:49 AM 0
Share

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 !

avatar image ryba · Jan 24, 2013 at 09:01 AM 0
Share

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.

avatar image Fattie · Jan 25, 2013 at 08:27 AM 0
Share

sure, I just meant it's a shame to add the library to the build.

again, thanks for the very valuable pointer - cheers

avatar image
0

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ryba · Jan 23, 2013 at 06:17 PM 0
Share

Tbat would be actually rewriting string class ;)

avatar image Fattie · Jan 24, 2013 at 08:50 AM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges