黑化肥发灰 发表于 2022-1-31 11:31

求助一个微信小程序的js函数sign值分析

请求里有一个sign值,在源码里找到了sign.js这个函数,关键就是楼主没搞清楚这是怎么拼出来的,想请大家看下sign.js函数的逻辑,先提前感谢各位大神的帮助了!
js源码下载链接在这里https://wwn.lanzoul.com/b030oqtbe 密码:2fks

var f=function(n){
      function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}
      function r(n,r,e,o,c,u){return t(function(n,t){return n<<t|n>>>32-t}(t(t(r,n),t(o,u)),c),e)}
      function e(n,t,e,o,c,u,a){return r(t&e|~t&o,n,t,c,u,a)}
      function o(n,t,e,o,c,u,a){return r(t&o|e&~o,n,t,c,u,a)}
      function c(n,t,e,o,c,u,a){return r(t^e^o,n,t,c,u,a)}
      function u(n,t,e,o,c,u,a){return r(e^(t|~o),n,t,c,u,a)}
      function a(n,r){n|=128<<r%32,n=r;var a,f,i,d,g,l=1732584193,h=-271733879,s=-1732584194,v=271733878;for(a=0;a<n.length;a+=16)f=l,i=h,d=s,g=v,l=e(l,h,s,v,n,7,-680876936),v=e(v,l,h,s,n,12,-389564586),s=e(s,v,l,h,n,17,606105819),h=e(h,s,v,l,n,22,-1044525330),l=e(l,h,s,v,n,7,-176418897),v=e(v,l,h,s,n,12,1200080426),s=e(s,v,l,h,n,17,-1473231341),h=e(h,s,v,l,n,22,-45705983),l=e(l,h,s,v,n,7,1770035416),v=e(v,l,h,s,n,12,-1958414417),s=e(s,v,l,h,n,17,-42063),h=e(h,s,v,l,n,22,-1990404162),l=e(l,h,s,v,n,7,1804603682),v=e(v,l,h,s,n,12,-40341101),s=e(s,v,l,h,n,17,-1502002290),l=o(l,h=e(h,s,v,l,n,22,1236535329),s,v,n,5,-165796510),v=o(v,l,h,s,n,9,-1069501632),s=o(s,v,l,h,n,14,643717713),h=o(h,s,v,l,n,20,-373897302),l=o(l,h,s,v,n,5,-701558691),v=o(v,l,h,s,n,9,38016083),s=o(s,v,l,h,n,14,-660478335),h=o(h,s,v,l,n,20,-405537848),l=o(l,h,s,v,n,5,568446438),v=o(v,l,h,s,n,9,-1019803690),s=o(s,v,l,h,n,14,-187363961),h=o(h,s,v,l,n,20,1163531501),l=o(l,h,s,v,n,5,-1444681467),v=o(v,l,h,s,n,9,-51403784),s=o(s,v,l,h,n,14,1735328473),l=c(l,h=o(h,s,v,l,n,20,-1926607734),s,v,n,4,-378558),v=c(v,l,h,s,n,11,-2022574463),s=c(s,v,l,h,n,16,1839030562),h=c(h,s,v,l,n,23,-35309556),l=c(l,h,s,v,n,4,-1530992060),v=c(v,l,h,s,n,11,1272893353),s=c(s,v,l,h,n,16,-155497632),h=c(h,s,v,l,n,23,-1094730640),l=c(l,h,s,v,n,4,681279174),v=c(v,l,h,s,n,11,-358537222),s=c(s,v,l,h,n,16,-722521979),h=c(h,s,v,l,n,23,76029189),l=c(l,h,s,v,n,4,-640364487),v=c(v,l,h,s,n,11,-421815835),s=c(s,v,l,h,n,16,530742520),l=u(l,h=c(h,s,v,l,n,23,-995338651),s,v,n,6,-198630844),v=u(v,l,h,s,n,10,1126891415),s=u(s,v,l,h,n,15,-1416354905),h=u(h,s,v,l,n,21,-57434055),l=u(l,h,s,v,n,6,1700485571),v=u(v,l,h,s,n,10,-1894986606),s=u(s,v,l,h,n,15,-1051523),h=u(h,s,v,l,n,21,-2054922799),l=u(l,h,s,v,n,6,1873313359),v=u(v,l,h,s,n,10,-30611744),s=u(s,v,l,h,n,15,-1560198380),h=u(h,s,v,l,n,21,1309151649),l=u(l,h,s,v,n,6,-145523070),v=u(v,l,h,s,n,10,-1120210379),s=u(s,v,l,h,n,15,718787259),h=u(h,s,v,l,n,21,-343485551),l=t(l,f),h=t(h,i),s=t(s,d),v=t(v,g);return}
      function f(n){var t,r="";for(t=0;t<32*n.length;t+=8)r+=String.fromCharCode(n>>>t%32&255);return r}
      function i(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r=0;for(t=0;t<8*n.length;t+=8)r|=(255&n.charCodeAt(t/8))<<t%32;return r}
      function d(n){var t,r,e="0123456789abcdef",o="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),o+=e.charAt(t>>>4&15)+e.charAt(15&t);return o}
      function g(n){return unescape(encodeURIComponent(n))}
      function l(n){return function(n){return f(a(i(n),8*n.length))}(g(n))}
      function h(n,t){return function(n,t){var r,e,o=i(n),c=[],u=[];for(c=u=void 0,o.length>16&&(o=a(o,8*n.length)),r=0;16>r;r+=1)c=909522486^o,u=1549556828^o;return e=a(c.concat(i(t)),512+8*t.length),f(a(u.concat(e),640))}(g(n),g(t))}return function(n,t,r){return t?r?h(t,n):function(n,t){return d(h(n,t))}(t,n):r?l(n):function(n){return d(l(n))}(n)}(n)}("188880000002"+u+a+"bbd2b25e7a8b4d94a8cc167ba2f27edd"+c+o+e+t);
      return"consumer=".concat("188880000002","&timestamp=").concat(a,"&nonce=").concat(u,"&sign=").concat(f,"&tenantId=").concat(c,"&cid=").concat(o,"&openId=").concat(e)};
//这里的sign=f的f 是怎么算出来的?

laos 发表于 2022-2-7 22:06

下个微信开发者工具 动态调试吧
页: [1]
查看完整版本: 求助一个微信小程序的js函数sign值分析