Reputation: 1605
Platform: Server - ASP.NET 3.5 / C#; client side - javascript/jQuery
This is what I want to do
I'm not looking at any sort of heavy duty encryption AES SHA whatever. I'm only interested in simple obfuscation - so if a user wants to persevere and decrypt the strings (which I will display anyway in a sequence, it's just that I don't want them to see all of them in the mark-up) then they can, it doesn't matter.
Are there any simple schemes to do this?
for clarity:
say I want to send a pre-filled array to the client browser with ["a'"b","c"]
when someone opens the source on the browser, he/she should see, say. ["m","n","o"]
but when I display, I would recompute it to "a" and show it. That's all.
Upvotes: 2
Views: 1818
Reputation: 36037
How about transforming it to base64 like the regular asp.net does for the viewstate by default / no encryption, just hiding.
I'd stick to the most basic thing, as youll have the js at the client to get it back anyway. A simple obfuscation algorithmic could be used instead if you need, but I wouldn't bother going into any real encryption for this.
Upvotes: 1
Reputation: 21881
What ever the intention may be... Why not just implement the simplest "encryption"-algorithm out there
Upvotes: 2
Reputation: 71573
Most algorithms for ciphering/encryption are language-agnostic. If you simply want to obfuscate the string from casual observation, I would implement a simple shift cipher (a->n). You'll have to write the encoder in C#, then the decoder in JavaScript; that's pretty much the whole story. Be aware that if you use the ASCII codes to shift, you have to avoid rolling over into "control" codes like newlines, and you can't include or encode into the ampersand "&" character. It may be simpler to hard-code identical arrays of valid character values, and provide an index offset that is the "shift"..
Upvotes: 1