Node.JS中调用JShaman,加密JS代码

在Node.JS环境中,调用JShaman的WebAPI接口,对JS代码进行混淆加密。

效果如下:

代码:

为什么要对JS代码混淆加密?

中文的说明很多了,引用一段老外的话语,看看外国人是怎样理解JS混淆加密必要性的:

There are numerous reasons why its a good idea to protect your code, such as: Prevent anyone from simply copy/pasting your work. This is specially important on 100% client side projects, such as HTML5 games; Removal of comments and whitespace that arent needed. Making it faster to load and harder to understand; Protection of work that hasnt been paid for yet. You can show your work to the client knowing that they wont have the source code until the invoice has been paid.

本例中,调用的是JShaman英文版的接口。

JShaman是国内知名的JS代码保护服务提供商,JShaman英文版跟中文版功能是有差异的:

主要是功能配置的不同:

具体,请到JShaman官网了解。

经验分享 程序员 微信小程序 职场和发展