隐藏函数中传递的变量
我有一个功能,我希望能够使其难以用眼睛进行更改/修改。
示例:
<script type="text/javascript">
myFunction({
var1: 356532,
othervar: "blablabla",
another: "#qwerty",
lastvar: "thisisthis"
});
</script>
这里知道变量的含义,就很容易进行更改。
有没有一种简单的方法让它变得难以理解(例如:混淆)?
显然,一旦传递到我的脚本,我就需要能够使用这些变量。
对此的任何建议将不胜感激。
更新:我需要这是一个可以在我的脚本上运行的函数(它是通过我制作的表单生成的)
我希望这更有意义。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要使用默默无闻作为安全措施。如果不允许他们知道变量的名称,则会出现严重的安全问题。不要说我没有警告你......
现在至于答案:对创建你自己的缩写的变量进行编码。但我不建议这样做。
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.
这就是我一直在寻找的。对于我的问题中的任何困惑,我们深表歉意。
http://javascriptcompressor.com/
This is what I was looking for. Sorry for any confusion in my question.
http://javascriptcompressor.com/