hide variables passed in a function
I have a function and I want to be able to make it difficult to change/amend with the eye.
example:
<script type="text/javascript">
myFunction({
var1: 356532,
othervar: "blablabla",
another: "#qwerty",
lastvar: "thisisthis"
});
</script>
Here knowing what the variables mean it would be easy to make changes.
Is there a simple way to make it difficult to understand (eg: Obfuscate)?
obvously I 开发者_高级运维would need to be able to use these variables once passed to my script.
Any advise on this would be much appreciated.
UPDATE: I would need this to be a function that I could run on my script (it's being generated via a form I have made)
I hope this make more sence.
Don't use obscurity as security. If they aren't allowed to know the names of the variables you've got a serious security issue. Don't say I didn't warn you...
Now as for the answer: encode the variables of create your own abbreviations. I wouldn't recommend that though.
If you are reading the data from a form then every obfuscation attempt is meaningless. Because it's very easy to find the code which reads the values from the form and then you can just to look how these form-data are used. E.g.: the "name"-data is obfuscated like this and ... Just make you tool so nice and handy that everyone is happy and nobody has to hack it.
This is what I was looking for. Sorry for any confusion in my question.
http://javascriptcompressor.com/
精彩评论