如何加密 JavaScript 代码使其不可解密? [英] How can I encrypt JavaScript code so that it's not decryptable?

查看:23
本文介绍了如何加密 JavaScript 代码使其不可解密?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些 JavaScript 代码需要加密,但我想确保没有人可以解密它.

I have some JavaScript code I need to encrypt, but I want to be sure no one can decrypt it.

我可以使用哪些工具来做到这一点?

What tools can I use to do this?

-- 编辑 --

我仍然想在我的网站上运行代码,我只是想确保没有其他人可以解密代码.

I still want to run the code on my site, I just want to make sure no one else can decrypt the code.

推荐答案

Javascript 代码在浏览器中执行,即在客户端,这意味着它必须在客户端未加密时可用.

The Javascript code is executed in the browser, i.e. on the client side, which means it must be available not-encrypted on the client side.

你能做的最好"可能是缩小它,这会让它更难理解——还有一点 混淆 也可以这样做——即使有人真正有动力仍然能够阅读它.

The "best" you can do is probably to minify it, which will make it harder to understand it -- and a bit of obfuscation might do too -- even if someone really motivated will still be able to read it.

例如参见 YUI Compressor,它可以缩小和混淆 JS 代码.

See for instance the YUI Compressor, which can both minify and obfuscate JS code.

这篇关于如何加密 JavaScript 代码使其不可解密?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆