提交 4327abd6 作者: 王进

分享报错调整

上级 29b503e8
......@@ -9,13 +9,13 @@ const sdkPortLinks = {
pay: pay_domain + '/notify/midas/pay.php' //扣费接口
}
class WechatSDK {
constructor(config?){
constructor(config?) {
this.printf("SDK START...", 0)
this.debug = config&&config.debug? config.debug : 0
this.debug = config && config.debug ? config.debug : 0
this.sdkinit()
}
private debug:number // 1是测试模式,用于printf函数输出
private userBtn:any // 用户授权按钮
private debug: number // 1是测试模式,用于printf函数输出
private userBtn: any // 用户授权按钮
private sdkinit() {
const that = this
that.userBtn = this.createUserInfoButton() // 创建用户授权按钮
......@@ -55,7 +55,7 @@ class WechatSDK {
}, err => { console.log(err) })
}
// 微信登录获取code,用code激活SDK换取openid
private getUserOpenId () {
private getUserOpenId() {
const that = this
this.login().then(res => {
that.printf("SDK -> wechat login:", 0)
......@@ -92,17 +92,17 @@ class WechatSDK {
// 用户登陆接口,返回用户平台信息
public Login(LoginCallBack) {
const that = this
let val:number = 0
if( this.obj.initReady == 1) { // 已经激活成功
let val: number = 0
if (this.obj.initReady == 1) { // 已经激活成功
that.doAuthorize(LoginCallBack)
} else { // 监听SDK激活,等激活完成之后才执行登录操作
Object.defineProperty(that.obj, 'initReady',{
enumerable:true,
configurable:true,
get:function getter() { return val; },
set:function setter(newVal) {
Object.defineProperty(that.obj, 'initReady', {
enumerable: true,
configurable: true,
get: function getter() { return val; },
set: function setter(newVal) {
//如果新设置的值跟之前的值是相等的,则不需要
if(newVal===val){ return; }
if (newVal === val) { return; }
that.doAuthorize(LoginCallBack)
}
})
......@@ -111,15 +111,15 @@ class WechatSDK {
//用户授权操作
private doAuthorize(LoginCallBack) {
const that = this
// 用户授权
// 用户授权
this.getUserInfo().then(res => {
if(res) { // 用户确认授权
if (res) { // 用户确认授权
that.doLogin(res, LoginCallBack)
} else {
console.log('用户取消授权。。。')
that.userBtn.show() // 显示授权按钮
that.userBtn.onTap(res => {
if(res.userInfo) that.doLogin(res, LoginCallBack)
if (res.userInfo) that.doLogin(res, LoginCallBack)
})
}
}, err => {
......@@ -144,13 +144,13 @@ class WechatSDK {
that.sdkParams.token = '' // 强制清空登录toekn
that.sdkRequest(sdkPortLinks.login, that.deepCopy({}, that.sdkParams, { nickname: UserObj.nickName }))
.then(res => {
if(res.code == 0) {
if (res.code == 0) {
// 根据SDK返回用户状态来判断统计接口是走注册还是登录
const type = res.data.action == 'login' ? 'login' : 'register'
that.sdkParams.token = res.data.token // 记录用户toekn
that.ReportParams.userId = res.data.uid // 记录用户ID
that.ReportData({ action: type }) // 上报登录/注册
LoginCallBack(that.deepCopy({}, res.data, that.getOptionsInfo(), userInfo, {
os: (that.ReportParams.system).split(' ')[0], // 返回系统类型IOS或者android
session_key: that.sdkParams.session_key // 返回session_key
......@@ -167,7 +167,7 @@ class WechatSDK {
that.sdkRequest(sdkPortLinks.order, that.deepCopy({}, that.sdkParams, Params)).then(res => {
console.log("订单返回---->", res)
if (res.code == 0) {
if(res.data.weixin_mini_program_app_id) { // 跳小程序支付
if (res.data.weixin_mini_program_app_id) { // 跳小程序支付
const postParams = that.deepCopy({}, that.sdkParams, Params, {
weixin_mini_program_app_id: res.data.weixin_mini_program_app_id, // 跳转小程序的appid,获取新openid用
sub_product_code: res.data.sub_product_code, // 跳转小程序的productcode
......@@ -186,7 +186,7 @@ class WechatSDK {
} else {
// 根据返回的用户订单状态判断是新订单还是未完成订单
if (res.data.order_type == 1) { // 新订单
that.MidasPaymentParams.buyQuantity = <number>(Params.money/100) * <number>res.data.weixin_proportion // 充值金额
that.MidasPaymentParams.buyQuantity = <number>(Params.money / 100) * <number>res.data.weixin_proportion // 充值金额
this.printf("SDK -> 发起支付参数:", 0)
this.printf(that.MidasPaymentParams, 0)
// 调微信米大师支付接口
......@@ -236,8 +236,8 @@ class WechatSDK {
const ShareParams = {
title: SDKConfig.shareTitle,
imageUrl: SDKConfig.shareImageUrl,
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&'+params
}
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + params
}
return this.share(ShareParams)
}
// 退出小游戏
......@@ -245,23 +245,23 @@ class WechatSDK {
return this.exitWechatApp()
}
// SDK上报接口
private sdkRequest (link:string, portData) {
private sdkRequest(link: string, portData) {
this.md5_sign(portData) // 附上签名参数
this.printf("SDK -> 接口上报参数:" + link, 0)
this.printf(portData, 0)
return this.request(link, portData)
}
// 数据上报接口,外部调用,参数中必须含有action值
public ReportData (portData) {
public ReportData(portData) {
const that = this
portData = that.deepCopy({}, that.ReportParams, portData)
portData.time = Date.parse(new Date().toString()) // 获取当前时间戳秒
portData.time = Date.parse(new Date().toString()) // 获取当前时间戳秒
this.printf("SDK -> 数据上报:", 0)
this.printf(portData, 0)
this.request(report, portData, 'POST')
}
// 调用微信请求接口
private request(URI:string, Params:any, Method = 'GET') {
private request(URI: string, Params: any, Method = 'GET') {
return this.fetchUri(URI, Params, Method).then(res => res.data)
}
/**
......@@ -272,7 +272,7 @@ class WechatSDK {
*/
private printf(obj: any, level: number = 3) {
if (this.debug == 1) {
switch (level){
switch (level) {
case 0:
console.log(obj)
break
......@@ -286,11 +286,11 @@ class WechatSDK {
}
}
//接口签名,直接返回完整对象
private md5_sign (obj) {
obj.time = Date.parse(new Date().toString()) // 获取请求的时间戳秒
private md5_sign(obj) {
obj.time = Date.parse(new Date().toString()) // 获取请求的时间戳秒
let keys = Object.keys(obj).sort();
let key_url="";
for(let i = 0; i < keys.length; i++) {
let key_url = "";
for (let i = 0; i < keys.length; i++) {
if (keys[i] != 'sign') key_url += keys[i] + '=' + obj[keys[i]] + '&'
}
key_url = key_url + SDKConfig.productKey
......@@ -414,14 +414,14 @@ class WechatSDK {
}
// 定义wechat方法
private async getUserInfo():Promise<any> {
private async getUserInfo(): Promise<any> {
return new Promise((resolve, reject) => {
(wx as any).getUserInfo({
withCredentials: true,
success: function(res) {
success: function (res) {
resolve(res);
},
fail: function(res) {
fail: function (res) {
reject(res)
}
})
......@@ -430,7 +430,7 @@ class WechatSDK {
})
}
private async login():Promise<any> {
private async login(): Promise<any> {
return new Promise((resolve, reject) => {
(wx as any).login({
success: (res) => {
......@@ -445,7 +445,7 @@ class WechatSDK {
})
}
private async getNetworkType():Promise<any> {
private async getNetworkType(): Promise<any> {
return new Promise((resolve, reject) => {
(wx as any).getNetworkType({
success: (res) => {
......@@ -457,7 +457,7 @@ class WechatSDK {
})
}
private async getSystemInfo():Promise<any> {
private async getSystemInfo(): Promise<any> {
return new Promise((resolve, reject) => {
(wx as any).getSystemInfo({
success: (res) => {
......@@ -469,7 +469,7 @@ class WechatSDK {
})
}
private async fetchUri(URI, DATA, METHOD):Promise<any> {
private async fetchUri(URI, DATA, METHOD): Promise<any> {
return new Promise((resolve, reject) => {
(wx as any).request({
url: URI,
......@@ -492,33 +492,33 @@ class WechatSDK {
confirmText: '确认'
}))
}
private async share(DATA):Promise<any> {
private async share(DATA): Promise<any> {
const that = this
return new Promise((resolve, reject) => {
(wx as any).shareAppMessage(that.deepCopy(DATA, {
success: function(res) {
success: function (res) {
resolve(res)
},
fail: function(res) {
fail: function (res) {
reject(res)
},
complete() {}
complete() { }
}))
})
}
private async pay(params):Promise<any> {
private async pay(params): Promise<any> {
const that = this
return new Promise((resolve, reject) => {
(wx as any).requestMidasPayment(that.deepCopy(params, {
success: function(res) {
success: function (res) {
resolve(res)
},
fail: function(res) {
fail: function (res) {
reject(res)
},
complete: function() {
complete: function () {
console.log("Rechare")
}
}))
......@@ -528,9 +528,9 @@ class WechatSDK {
private shareInit() {
(wx as any).showShareMenu({
withShareTicket: true,
success: () => {},
fail: () => {},
complete: () => {}
success: () => { },
fail: () => { },
complete: () => { }
})
}
// 分享
......@@ -542,7 +542,7 @@ class WechatSDK {
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + DATA
};
(wx as any).onShareAppMessage(() => {
return that.deepCopy(DATA, CALLBACK)
return that.deepCopy(ShareParams, CALLBACK)
})
that.shareInit()
}
......@@ -563,14 +563,14 @@ class WechatSDK {
})
}
private async exitWechatApp():Promise<any> {
private async exitWechatApp(): Promise<any> {
return new Promise((resolve, reject) => {
(wx as any).exitMiniProgram({
success: function(res) {
success: function (res) {
console.log('退出成功')
resolve(res)
},
fail: function(res) {
fail: function (res) {
console.log('退出失败')
reject(res)
}
......@@ -581,12 +581,12 @@ class WechatSDK {
public getOptionsInfo() {
const that = this
const options = (wx as any).getLaunchOptionsSync()
if (Object.keys(options.query).length > 0 || Object.keys(options.referrerInfo).length > 0) {
if (!options.query || !options.referrerInfo || Object.keys(options.query).length == 0 || Object.keys(options.referrerInfo).length == 0) {
return options
} else {
const obj = {}
that.deepCopy(obj, options.query, options.referrerInfo.extraData) // 合并数据
return obj
} else {
return options
}
}
......@@ -608,4 +608,4 @@ class WechatSDK {
}
// md5加密
const rotateLeft = (lValue,iShiftBits) => {return(lValue<<iShiftBits)|(lValue>>>(32-iShiftBits))};var addUnsigned=function(lX,lY){var lX4,lY4,lX8,lY8,lResult;lX8=(lX&2147483648);lY8=(lY&2147483648);lX4=(lX&1073741824);lY4=(lY&1073741824);lResult=(lX&1073741823)+(lY&1073741823);if(lX4&lY4){return(lResult^2147483648^lX8^lY8)}if(lX4|lY4){if(lResult&1073741824){return(lResult^3221225472^lX8^lY8)}else{return(lResult^1073741824^lX8^lY8)}}else{return(lResult^lX8^lY8)}};var F=function(x,y,z){return(x&y)|((~x)&z)};var G=function(x,y,z){return(x&z)|(y&(~z))};var H=function(x,y,z){return(x^y^z)};var I=function(x,y,z){return(y^(x|(~z)))};var FF=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(F(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b)};var GG=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(G(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b)};var HH=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(H(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b)};var II=function(a,b,c,d,x,s,ac){a=addUnsigned(a,addUnsigned(addUnsigned(I(b,c,d),x),ac));return addUnsigned(rotateLeft(a,s),b)};var convertToWordArray=function(string){var lWordCount;var lMessageLength=string.length;var lNumberOfWordsTempOne=lMessageLength+8;var lNumberOfWordsTempTwo=(lNumberOfWordsTempOne-(lNumberOfWordsTempOne%64))/64;var lNumberOfWords=(lNumberOfWordsTempTwo+1)*16;var lWordArray=Array(lNumberOfWords-1);var lBytePosition=0;var lByteCount=0;while(lByteCount<lMessageLength){lWordCount=(lByteCount-(lByteCount%4))/4;lBytePosition=(lByteCount%4)*8;lWordArray[lWordCount]=(lWordArray[lWordCount]|(string.charCodeAt(lByteCount)<<lBytePosition));lByteCount++}lWordCount=(lByteCount-(lByteCount%4))/4;lBytePosition=(lByteCount%4)*8;lWordArray[lWordCount]=lWordArray[lWordCount]|(128<<lBytePosition);lWordArray[lNumberOfWords-2]=lMessageLength<<3;lWordArray[lNumberOfWords-1]=lMessageLength>>>29;return lWordArray};var wordToHex=function(lValue){var WordToHexValue="",WordToHexValueTemp="",lByte,lCount;for(lCount=0;lCount<=3;lCount++){lByte=(lValue>>>(lCount*8))&255;WordToHexValueTemp="0"+lByte.toString(16);WordToHexValue=WordToHexValue+WordToHexValueTemp.substr(WordToHexValueTemp.length-2,2)}return WordToHexValue};var uTF8Encode=function(string){string=string.replace(/\x0d\x0a/g,"\x0a");var output="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){output+=String.fromCharCode(c)}else{if((c>127)&&(c<2048)){output+=String.fromCharCode((c>>6)|192);output+=String.fromCharCode((c&63)|128)}else{output+=String.fromCharCode((c>>12)|224);output+=String.fromCharCode(((c>>6)&63)|128);output+=String.fromCharCode((c&63)|128)}}}return output};function md5(string){var x=Array();var k,AA,BB,CC,DD,a,b,c,d;var S11=7,S12=12,S13=17,S14=22;var S21=5,S22=9,S23=14,S24=20;var S31=4,S32=11,S33=16,S34=23;var S41=6,S42=10,S43=15,S44=21;string=uTF8Encode(string);x=convertToWordArray(string);a=1732584193;b=4023233417;c=2562383102;d=271733878;for(k=0;k<x.length;k+=16){AA=a;BB=b;CC=c;DD=d;a=FF(a,b,c,d,x[k+0],S11,3614090360);d=FF(d,a,b,c,x[k+1],S12,3905402710);c=FF(c,d,a,b,x[k+2],S13,606105819);b=FF(b,c,d,a,x[k+3],S14,3250441966);a=FF(a,b,c,d,x[k+4],S11,4118548399);d=FF(d,a,b,c,x[k+5],S12,1200080426);c=FF(c,d,a,b,x[k+6],S13,2821735955);b=FF(b,c,d,a,x[k+7],S14,4249261313);a=FF(a,b,c,d,x[k+8],S11,1770035416);d=FF(d,a,b,c,x[k+9],S12,2336552879);c=FF(c,d,a,b,x[k+10],S13,4294925233);b=FF(b,c,d,a,x[k+11],S14,2304563134);a=FF(a,b,c,d,x[k+12],S11,1804603682);d=FF(d,a,b,c,x[k+13],S12,4254626195);c=FF(c,d,a,b,x[k+14],S13,2792965006);b=FF(b,c,d,a,x[k+15],S14,1236535329);a=GG(a,b,c,d,x[k+1],S21,4129170786);d=GG(d,a,b,c,x[k+6],S22,3225465664);c=GG(c,d,a,b,x[k+11],S23,643717713);b=GG(b,c,d,a,x[k+0],S24,3921069994);a=GG(a,b,c,d,x[k+5],S21,3593408605);d=GG(d,a,b,c,x[k+10],S22,38016083);c=GG(c,d,a,b,x[k+15],S23,3634488961);b=GG(b,c,d,a,x[k+4],S24,3889429448);a=GG(a,b,c,d,x[k+9],S21,568446438);d=GG(d,a,b,c,x[k+14],S22,3275163606);c=GG(c,d,a,b,x[k+3],S23,4107603335);b=GG(b,c,d,a,x[k+8],S24,1163531501);a=GG(a,b,c,d,x[k+13],S21,2850285829);d=GG(d,a,b,c,x[k+2],S22,4243563512);c=GG(c,d,a,b,x[k+7],S23,1735328473);b=GG(b,c,d,a,x[k+12],S24,2368359562);a=HH(a,b,c,d,x[k+5],S31,4294588738);d=HH(d,a,b,c,x[k+8],S32,2272392833);c=HH(c,d,a,b,x[k+11],S33,1839030562);b=HH(b,c,d,a,x[k+14],S34,4259657740);a=HH(a,b,c,d,x[k+1],S31,2763975236);d=HH(d,a,b,c,x[k+4],S32,1272893353);c=HH(c,d,a,b,x[k+7],S33,4139469664);b=HH(b,c,d,a,x[k+10],S34,3200236656);a=HH(a,b,c,d,x[k+13],S31,681279174);d=HH(d,a,b,c,x[k+0],S32,3936430074);c=HH(c,d,a,b,x[k+3],S33,3572445317);b=HH(b,c,d,a,x[k+6],S34,76029189);a=HH(a,b,c,d,x[k+9],S31,3654602809);d=HH(d,a,b,c,x[k+12],S32,3873151461);c=HH(c,d,a,b,x[k+15],S33,530742520);b=HH(b,c,d,a,x[k+2],S34,3299628645);a=II(a,b,c,d,x[k+0],S41,4096336452);d=II(d,a,b,c,x[k+7],S42,1126891415);c=II(c,d,a,b,x[k+14],S43,2878612391);b=II(b,c,d,a,x[k+5],S44,4237533241);a=II(a,b,c,d,x[k+12],S41,1700485571);d=II(d,a,b,c,x[k+3],S42,2399980690);c=II(c,d,a,b,x[k+10],S43,4293915773);b=II(b,c,d,a,x[k+1],S44,2240044497);a=II(a,b,c,d,x[k+8],S41,1873313359);d=II(d,a,b,c,x[k+15],S42,4264355552);c=II(c,d,a,b,x[k+6],S43,2734768916);b=II(b,c,d,a,x[k+13],S44,1309151649);a=II(a,b,c,d,x[k+4],S41,4149444226);d=II(d,a,b,c,x[k+11],S42,3174756917);c=II(c,d,a,b,x[k+2],S43,718787259);b=II(b,c,d,a,x[k+9],S44,3951481745);a=addUnsigned(a,AA);b=addUnsigned(b,BB);c=addUnsigned(c,CC);d=addUnsigned(d,DD)}var tempValue=wordToHex(a)+wordToHex(b)+wordToHex(c)+wordToHex(d);return tempValue.toLowerCase()};
\ No newline at end of file
const rotateLeft = (lValue, iShiftBits) => { return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)) }; var addUnsigned = function (lX, lY) { var lX4, lY4, lX8, lY8, lResult; lX8 = (lX & 2147483648); lY8 = (lY & 2147483648); lX4 = (lX & 1073741824); lY4 = (lY & 1073741824); lResult = (lX & 1073741823) + (lY & 1073741823); if (lX4 & lY4) { return (lResult ^ 2147483648 ^ lX8 ^ lY8) } if (lX4 | lY4) { if (lResult & 1073741824) { return (lResult ^ 3221225472 ^ lX8 ^ lY8) } else { return (lResult ^ 1073741824 ^ lX8 ^ lY8) } } else { return (lResult ^ lX8 ^ lY8) } }; var F = function (x, y, z) { return (x & y) | ((~x) & z) }; var G = function (x, y, z) { return (x & z) | (y & (~z)) }; var H = function (x, y, z) { return (x ^ y ^ z) }; var I = function (x, y, z) { return (y ^ (x | (~z))) }; var FF = function (a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b) }; var GG = function (a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b) }; var HH = function (a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b) }; var II = function (a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b) }; var convertToWordArray = function (string) { var lWordCount; var lMessageLength = string.length; var lNumberOfWordsTempOne = lMessageLength + 8; var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64; var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16; var lWordArray = Array(lNumberOfWords - 1); var lBytePosition = 0; var lByteCount = 0; while (lByteCount < lMessageLength) { lWordCount = (lByteCount - (lByteCount % 4)) / 4; lBytePosition = (lByteCount % 4) * 8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); lByteCount++ } lWordCount = (lByteCount - (lByteCount % 4)) / 4; lBytePosition = (lByteCount % 4) * 8; lWordArray[lWordCount] = lWordArray[lWordCount] | (128 << lBytePosition); lWordArray[lNumberOfWords - 2] = lMessageLength << 3; lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; return lWordArray }; var wordToHex = function (lValue) { var WordToHexValue = "", WordToHexValueTemp = "", lByte, lCount; for (lCount = 0; lCount <= 3; lCount++) { lByte = (lValue >>> (lCount * 8)) & 255; WordToHexValueTemp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2) } return WordToHexValue }; var uTF8Encode = function (string) { string = string.replace(/\x0d\x0a/g, "\x0a"); var output = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { output += String.fromCharCode(c) } else { if ((c > 127) && (c < 2048)) { output += String.fromCharCode((c >> 6) | 192); output += String.fromCharCode((c & 63) | 128) } else { output += String.fromCharCode((c >> 12) | 224); output += String.fromCharCode(((c >> 6) & 63) | 128); output += String.fromCharCode((c & 63) | 128) } } } return output }; function md5(string) { var x = Array(); var k, AA, BB, CC, DD, a, b, c, d; var S11 = 7, S12 = 12, S13 = 17, S14 = 22; var S21 = 5, S22 = 9, S23 = 14, S24 = 20; var S31 = 4, S32 = 11, S33 = 16, S34 = 23; var S41 = 6, S42 = 10, S43 = 15, S44 = 21; string = uTF8Encode(string); x = convertToWordArray(string); a = 1732584193; b = 4023233417; c = 2562383102; d = 271733878; for (k = 0; k < x.length; k += 16) { AA = a; BB = b; CC = c; DD = d; a = FF(a, b, c, d, x[k + 0], S11, 3614090360); d = FF(d, a, b, c, x[k + 1], S12, 3905402710); c = FF(c, d, a, b, x[k + 2], S13, 606105819); b = FF(b, c, d, a, x[k + 3], S14, 3250441966); a = FF(a, b, c, d, x[k + 4], S11, 4118548399); d = FF(d, a, b, c, x[k + 5], S12, 1200080426); c = FF(c, d, a, b, x[k + 6], S13, 2821735955); b = FF(b, c, d, a, x[k + 7], S14, 4249261313); a = FF(a, b, c, d, x[k + 8], S11, 1770035416); d = FF(d, a, b, c, x[k + 9], S12, 2336552879); c = FF(c, d, a, b, x[k + 10], S13, 4294925233); b = FF(b, c, d, a, x[k + 11], S14, 2304563134); a = FF(a, b, c, d, x[k + 12], S11, 1804603682); d = FF(d, a, b, c, x[k + 13], S12, 4254626195); c = FF(c, d, a, b, x[k + 14], S13, 2792965006); b = FF(b, c, d, a, x[k + 15], S14, 1236535329); a = GG(a, b, c, d, x[k + 1], S21, 4129170786); d = GG(d, a, b, c, x[k + 6], S22, 3225465664); c = GG(c, d, a, b, x[k + 11], S23, 643717713); b = GG(b, c, d, a, x[k + 0], S24, 3921069994); a = GG(a, b, c, d, x[k + 5], S21, 3593408605); d = GG(d, a, b, c, x[k + 10], S22, 38016083); c = GG(c, d, a, b, x[k + 15], S23, 3634488961); b = GG(b, c, d, a, x[k + 4], S24, 3889429448); a = GG(a, b, c, d, x[k + 9], S21, 568446438); d = GG(d, a, b, c, x[k + 14], S22, 3275163606); c = GG(c, d, a, b, x[k + 3], S23, 4107603335); b = GG(b, c, d, a, x[k + 8], S24, 1163531501); a = GG(a, b, c, d, x[k + 13], S21, 2850285829); d = GG(d, a, b, c, x[k + 2], S22, 4243563512); c = GG(c, d, a, b, x[k + 7], S23, 1735328473); b = GG(b, c, d, a, x[k + 12], S24, 2368359562); a = HH(a, b, c, d, x[k + 5], S31, 4294588738); d = HH(d, a, b, c, x[k + 8], S32, 2272392833); c = HH(c, d, a, b, x[k + 11], S33, 1839030562); b = HH(b, c, d, a, x[k + 14], S34, 4259657740); a = HH(a, b, c, d, x[k + 1], S31, 2763975236); d = HH(d, a, b, c, x[k + 4], S32, 1272893353); c = HH(c, d, a, b, x[k + 7], S33, 4139469664); b = HH(b, c, d, a, x[k + 10], S34, 3200236656); a = HH(a, b, c, d, x[k + 13], S31, 681279174); d = HH(d, a, b, c, x[k + 0], S32, 3936430074); c = HH(c, d, a, b, x[k + 3], S33, 3572445317); b = HH(b, c, d, a, x[k + 6], S34, 76029189); a = HH(a, b, c, d, x[k + 9], S31, 3654602809); d = HH(d, a, b, c, x[k + 12], S32, 3873151461); c = HH(c, d, a, b, x[k + 15], S33, 530742520); b = HH(b, c, d, a, x[k + 2], S34, 3299628645); a = II(a, b, c, d, x[k + 0], S41, 4096336452); d = II(d, a, b, c, x[k + 7], S42, 1126891415); c = II(c, d, a, b, x[k + 14], S43, 2878612391); b = II(b, c, d, a, x[k + 5], S44, 4237533241); a = II(a, b, c, d, x[k + 12], S41, 1700485571); d = II(d, a, b, c, x[k + 3], S42, 2399980690); c = II(c, d, a, b, x[k + 10], S43, 4293915773); b = II(b, c, d, a, x[k + 1], S44, 2240044497); a = II(a, b, c, d, x[k + 8], S41, 1873313359); d = II(d, a, b, c, x[k + 15], S42, 4264355552); c = II(c, d, a, b, x[k + 6], S43, 2734768916); b = II(b, c, d, a, x[k + 13], S44, 1309151649); a = II(a, b, c, d, x[k + 4], S41, 4149444226); d = II(d, a, b, c, x[k + 11], S42, 3174756917); c = II(c, d, a, b, x[k + 2], S43, 718787259); b = II(b, c, d, a, x[k + 9], S44, 3951481745); a = addUnsigned(a, AA); b = addUnsigned(b, BB); c = addUnsigned(c, CC); d = addUnsigned(d, DD) } var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); return tempValue.toLowerCase() };
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论