混同和加密是爱护 JavaScript 代码安全性的无效办法。混同能够使代码变得更加难以了解,而加密能够使代码变得不可读。开发人员能够抉择依据本人的需要和安全性需要来抉择适当的混同和加密技术,以爱护 JavaScript 代码的安全性。
以下是一个简略的例子
function calculateSum(a, b) {return a + b;}
var x = calculateSum(2, 3);
console.log(x);
混同后
var _0x15b5=['sum','function','log','calculateSum','call','console','apply','concat'];(function(_0x2f98dc,_0x15b5c7){var _0x3e7c8a=function(_0x10c0b9){while(--_0x10c0b9){_0x2f98dc['push'](_0x2f98dc['shift']());}};_0x3e7c8a(++_0x15b5c7);}(_0x15b5,0x103));var _0x3e7c=function(_0x2f98dc,_0x15b5c7){_0x2f98dc=_0x2f98dc-0x0;var _0x3e7c8a=_0x15b5[_0x2f98dc];return _0x3e7c8a;};function _0x15b5c7(_0x2f98dc,_0x15b5){return _0x2f98dc+_0x15b5;}var _0x1e5143=_0x3e7c('0x0')+_0x3e7c('0x3')+_0x3e7c('0x1')+_0x3e7c('0x6')+_0x3e7c('0x2');var _0x30e35a={};_0x30e35a[_0x3e7c('0x4')]=_0x15b5c7;var _0x4079dc=_0x30e35a[_0x1e5143]([0x2,0x3]);_0x3e7c('0x5')[_0x3e7c('0x4')][_0x3e7c('0x7')](_0x4079dc);
加密后
var _0xe3d4=['\x53\x6F\x6D\x65\x20\x73\x74\x72\x69\x6E\x67','\x66\x75\x6E\x63\x74\x69\x6F\x6E','\x72\x65\x74\x75\x72\x6E\x20\x61\x2B\x62','\x63\x61\x6C\x6C\x2E\x61\x70\x70\x6C\x79','\x69\x6D\x70\x6F\x72\x74\x20\x6A\x73','\x43\x6F\x6E\x73\x6F\x6C\x65','\x61\x70\x70\x6C\x79','\x63\x6F\x6E\x63\x61\x74'];(function(_0x13f17f,_0xe3d4d1){var _0x47fc97=function(_0x4657c2){while(--_0x4657c2){_0x13f17f['push'](_0x13f17f['shift']());}};_0x47fc97(++_0xed4d1);}(_0xe3d4,0x142));var _0x47fc=function(_0x13f17f,_0xe3d4d1){_0x13f17f=_0x13f17f-0x0;var _0x47fc97=_0xe3d4[_0x13f17f];return _0x47fc97;};function _0x3c06(_0x13f17f,_0xe3d4d1){return _0x13f17f+_0xe3d4d1;}var _0x5c156b=_0x47fc('0x5')+_0x47fc('0x0')+_0x47fc('0x6')+_0x47fc('0x1')+_0x47fc('0x3')+_0x47fc('0x7')+_0x47fc('0x2')+_0x47fc('0x4');var _0x52db9c={};_0x52db9c[_0x47fc('0x8')]=_0x3c06;var _0x151b0c=_0x52db9c[_0x5c156b]([0x2,0x3]);_0x47fc('0x9')[_0x47fc('0x8')][_0x47fc('0xa')](_0x151b0c);
解开之后
function calculateSum(a, b) {return a + b;}
var x = calculateSum(2, 3);
console.log(x);
jsjiami.com
如果您对文章内容有不同认识, 或者疑难,欢送到评论区留言,或者私信我都能够。
也能够到上方网站,底部有我联系方式详谈
如遇本人源码加密后没备份,能够找咱们解决解出复原源码,任何加密都能够。