Javascript(js)如何加密和解密?(How is Javascript (js) encrypted and decrypted?)

编程入门 行业动态 更新时间:2024-10-18 14:24:45
Javascript(js)如何加密和解密?(How is Javascript (js) encrypted and decrypted?)

我通过研究许多文件.js来学习javascript,但我什么都听不懂。 其中许多开头是:

(function(){var aa=encodeURIComponent,f=window,ba=setTimeout,n=Math,ea=RegExp;function fa(a,b){return a.name=b}function Pc(a,b){return a.href=b}...

我认为这是加密代码以保护的一种方法。 我对吗? 如果是真的,我该怎么办? 如果我想解密它,请告诉我该怎么做。 谢谢。 p / s:我是新手

I am learning javascript by studying many file .js but I can't understand anything. Many of them start with:

(function(){var aa=encodeURIComponent,f=window,ba=setTimeout,n=Math,ea=RegExp;function fa(a,b){return a.name=b}function Pc(a,b){return a.href=b}...

I think this is one way to encrypt the code to protect. Am I right? If it's true, how can I do it? If I want to decrypt it, plz show me how to do. Thanks. p/s: I'm a newbie

最满意答案

你无法真正加密javascript。 你可以混淆,这使得它更难以阅读和缩小(有争议的是更难阅读,但更重要的是占用空间更小)

缩小

http://jscompress.com/是一个这样的缩小器。

如果你想混淆你的代码(从而使它更难阅读,但不会让它变小(事实上通常你会得到更多的字节),你可以看看这个:

混淆

http://javascriptobfuscator.com/

美化

就像这里的评论所说的那样,为了'解密'所说的代码,你可以去http://jsbeautifier.org/ 。 虽然当它被混淆时,它对你没有多大帮助。

You cannot really encrypt javascript. You can obfuscate which makes it harder to read and minify (which is arguebly also harder to read, but more importantly has a smaller footprint)

MINIFY

http://jscompress.com/ is one such minifier.

If you wish to obfuscate your code (thus making it harder to read, but not making it smaller (in fact usually you end up with more bytes), you could look at this:

OBFUSCATE

http://javascriptobfuscator.com/

BEAUTIFY

Like the comments here said, to 'decrypt' said piece of code, you could go to http://jsbeautifier.org/. Although when it's obfuscated it won't do you much good.

更多推荐

本文发布于:2023-08-05 23:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1441028.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:js   Javascript   decrypted   encrypted

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!