How can I encrypt JavaScript code so that it's not decryptable?

前端 未结 12 2170
温柔的废话
温柔的废话 2020-12-01 15:07

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?

-- Edit --

12条回答
  •  自闭症患者
    2020-12-01 15:41

    If you truly want to encrypt it so that no one else can decrypt it, you could use one of any number of encryptions. For instance, to do it manually, you could use TrueCrypt; or to do it programatically, use the encryption libraries available in most languages.

    If what you are really asking, though, is how to obfuscate the code so that no one can reverse-engineer it, the answer is: you can't, not in Javascript or any other language. The best you can do is make it more difficult on the reverse-engineers by making it hard to read; for that, there are any number of tools:

    • javascriptobfuscator.com
    • javascript obfuscator
    • ObfuscateJS

提交回复
热议问题