更新api和部分方法

This commit is contained in:
2018-04-18 22:34:54 +08:00
parent 13ab681205
commit 298f903d02
14 changed files with 727 additions and 13 deletions
@@ -164,7 +164,7 @@
<tr>
<td class="text-center small">服务器地址</td>
<td>
@ViewBag.remoteip
@Utils.GetServerUrl()
</td>
</tr>
<tr>
@@ -174,7 +174,7 @@
</td>
</tr>
<tr>
<td class="text-center small">网站IP</td>
<td class="text-center small">本地IP地址</td>
<td>
@Utils.GetIP()
</td>
+3 -1
View File
@@ -5,12 +5,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
<PackageReference Include="MySql.Data" Version="6.10.6" />
<PackageReference Include="NewLife.XCode" Version="9.6.6678.32715" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Senparc.Weixin.MP" Version="14.10.13" />
<PackageReference Include="Senparc.Weixin.WxOpen" Version="1.9.1" />
<PackageReference Include="ZKWeb.System.Drawing" Version="4.0.1" />
</ItemGroup>
+1 -1
View File
@@ -34,7 +34,7 @@ namespace COMCMS.Web.Controllers
ViewBag.siteName = cfg.SiteName;
ViewBag.c = CookiesHelper.GetCookie("abc");
ViewBag.d = Utils.SIGNSALT;
ViewBag.d = Utils.GetServerUrl();
return View();
}
@@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using COMCMS.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace COMCMS.Web.Controllers.api
{
[Produces("application/json")]
public class APIBaseController : Controller
{
#region 通用信息
public ReJSON reJson = new ReJSON();
#endregion
#region 验证签名
public bool CheckSignature(SortedDictionary<string, string> pars, string signature)
{
if (!MySign.CheckSign(pars, signature))
{
reJson.code = 40004;
reJson.message = "signature 错误!";
return false;
}
//判断是否超时
string timeStamp = pars["timeStamp"];
//判断时间有效性
DateTime postTime = Utils.StampToDateTime(timeStamp);
if (postTime < DateTime.Now.AddSeconds(-120))//30秒有效期
{
reJson.code = 40004;
reJson.message = "数据请求超时!";
reJson.isReload = 1;
return false;
}
return true;
}
#endregion
#region 自动验证QueryString 的签名
/// <summary>
/// 自动验证QueryString 的签名
/// </summary>
/// <returns></returns>
public bool AutoCheckQueryStringSignature()
{
var queryStrings = Request.Query;
List<string> keys = new List<string>();
//string[] keys = HttpContext.Current.Request.QueryString.AllKeys;
if (queryStrings == null)
{
return false;
}
foreach (var item in queryStrings.Keys)
{
keys.Add(item);
}
SortedDictionary<string, string> pars = new SortedDictionary<string, string>();
string signature = "";
foreach (var k in keys)
{
if (k != "signature")
{
string v = Request.Query[k];
pars.Add(k, v);
}
else
{
signature = Request.Query[k];
}
}
//没有签名返回错误
if (string.IsNullOrEmpty(signature))
return false;
return CheckSignature(pars, signature);
}
#endregion
}
#region 通用返回信息
public class ReJSON
{
/// <summary>
/// 返回代码 0 为正确
/// </summary>
public int code { get; set; } = 40000;
/// <summary>
/// 提示语
/// </summary>
public string message { get; set; }
/// <summary>
/// 是否重新加载
/// </summary>
public int isReload { get; set; } = 0;
/// <summary>
/// 数据详情 object
/// </summary>
public object detail { get; set; }
}
#endregion
}
+25 -6
View File
@@ -11,8 +11,8 @@ using XCode;
namespace COMCMS.Web.Controllers.api
{
[Route("api/[controller]")]
public class IndexController : Controller
[Route("api/[controller]/[action]")]
public class IndexController : APIBaseController
{
// GET: api/<controller>
[HttpGet]
@@ -22,11 +22,30 @@ namespace COMCMS.Web.Controllers.api
return cfg;
}
// GET api/<controller>/5
[HttpGet("{id}")]
public string Get(int id)
#region 测试验签
/// <summary>
/// 测试验签
/// </summary>
/// <param name="id">id</param>
/// <param name="random"></param>
/// <param name="timeStamp"></param>
/// <param name="signature"></param>
/// <returns></returns>
[HttpGet]
public object CheckSign(string id, string random = "", string timeStamp = "", string signature = "")
{
return "value";
if (!AutoCheckQueryStringSignature())
{
reJson.message = "验签失败!";
return reJson;
}
else
{
reJson.code = 0;
reJson.message = "验签成功!";
return reJson;
}
}
#endregion
}
}
@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using COMCMS.Common;
using COMCMS.Core;
using XCode;
using NewLife.Log;
using Senparc.Weixin.MP;
using Senparc.Weixin.MP.TenPayLibV3;
using Newtonsoft.Json;
namespace COMCMS.Web.Controllers.api
{
/// <summary>
/// 支付API
/// </summary>
[Produces("application/json")]
[Route("api/Payment")]
public class PaymentController : APIBaseController
{
#region 微信小程序订单支付
[HttpGet]
public object DoPayOrder(string ordernum, string random = "", string timeStamp = "", string signature = "")
{
if (!AutoCheckQueryStringSignature())
{
return reJson;
}
//获取订单
Order entity = Order.Find(Order._.OrderNum == ordernum);
if (entity == null)
{
reJson.code = 40000;
reJson.message = "系统找不到本订单!";
return reJson;
}
//判断订单状态
if (entity.OrderStatus == Utils.OrdersState[3])
{
reJson.code = 40000;
reJson.message = "已完成订单不允许支付!";
return reJson;
}
if (entity.PaymentStatus != Utils.PaymentState[0])
{
reJson.code = 40000;
reJson.message = "当前订单支付状态不允许支付!";
return reJson;
}
//获取用户并判断是否是已经注册用户
Member my = Member.FindById(entity.UId);
if (my == null || string.IsNullOrEmpty(my.WeixinAppOpenId))
{
reJson.code = 40000;
reJson.message = "用户状态错误,无法使用本功能!";
return reJson;
}
//开始生成支付订单
OnlinePayOrder model = new OnlinePayOrder();
model.OrderId = entity.Id;
model.OrderNum = entity.OrderNum;
model.PayId = 1;
model.PaymentNotes = "微信支付";
model.PaymentStatus = Utils.PaymentState[0];
model.PayOrderNum = Utils.GetOrderNum();//在线支付订单的订单号
model.PayType = "微信支付";
model.TotalPrice = entity.TotalPay;
model.TotalQty = entity.TotalQty;
model.UId = entity.UId;
model.IP = Utils.GetIP();
model.IsOK = 0;
model.AddTime = DateTime.Now;
model.Insert();
//写入日志
OrderLog log = new OrderLog();
log.AddTime = DateTime.Now;
log.OrderId = entity.Id;
log.OrderNum = entity.OrderNum;
log.UId = entity.UId;
log.Actions = "用户使用微信支付;支付订单号:" + model.PayOrderNum;
log.Insert();
Core.Config cfg = Core.Config.GetSystemConfig();
string appId = cfg.WXAppId;// ConfigurationManager.AppSettings["WeixinAppId"];
string appSecrect = cfg.WXAppSecret;// ConfigurationManager.AppSettings["WeixinAppSecrect"];
string wxmchId = cfg.MCHId;// ConfigurationManager.AppSettings["WeixinMCHId"];
string wxmchKey = cfg.MCHKey;// ConfigurationManager.AppSettings["WeixinMCHKey"];
TenPayV3Info TenPayV3Info = new TenPayV3Info(appId, appSecrect, wxmchId, wxmchKey, Utils.GetServerUrl() + "/wxpayment/notify");
TenPayV3Info.TenPayV3Notify = Utils.GetServerUrl() + "/wxpayment/notify";
XTrace.WriteLine("微信支付异步通知地址:" + TenPayV3Info.TenPayV3Notify);
//创建支付应答对象
RequestHandler packageReqHandler = new RequestHandler(null);
var sp_billno = DateTime.Now.ToString("HHmmss") + TenPayV3Util.BuildRandomStr(26);//最多32位
var nonceStr = TenPayV3Util.GetNoncestr();
string rtimeStamp = Utils.GetTimeStamp();
//创建请求统一订单接口参数
var xmlDataInfo = new TenPayV3UnifiedorderRequestData(TenPayV3Info.AppId, TenPayV3Info.MchId, entity.Title, model.PayOrderNum, (int)(entity.TotalPay * 100), Utils.GetIP(), TenPayV3Info.TenPayV3Notify, TenPayV3Type.JSAPI, my.WeixinAppOpenId, TenPayV3Info.Key, nonceStr);
//返回给微信的请求
RequestHandler res = new RequestHandler(null);
try
{
//调用统一订单接口
var result = TenPayV3.Unifiedorder(xmlDataInfo);
XTrace.WriteLine("微信支付统一下单返回:" + JsonConvert.SerializeObject(result));
if (result.return_code == "FAIL")
{
reJson.code = 40005;
reJson.message = result.return_msg;
return reJson;
}
string nativeReqSign = res.CreateMd5Sign("key", TenPayV3Info.Key);
//https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3
//paySign = MD5(appId=wxd678efh567hg6787&nonceStr=5K8264ILTKCH16CQ2502SI8ZNMTM67VS&package=prepay_id=wx2017033010242291fcfe0db70013231072&signType=MD5&timeStamp=1490840662&key=qazwsxedcrfvtgbyhnujmikolp111111)
string paySign = Utils.MD5($"appId={TenPayV3Info.AppId}&nonceStr={nonceStr}&package=prepay_id={result.prepay_id}&signType=MD5&timeStamp={rtimeStamp}&key={TenPayV3Info.Key}").ToUpper();
string package = $"prepay_id={result.prepay_id}";
dynamic detail = new { timeStamp = rtimeStamp, nonceStr = nonceStr, package = package, signType = "MD5", paySign = paySign };
reJson.code = 0;
reJson.message = "下单成功!";
reJson.detail = detail;
return reJson;
}
catch (Exception ex)
{
res.SetParameter("return_code", "FAIL");
res.SetParameter("return_msg", "统一下单失败");
XTrace.WriteLine($"统一下单失败:{ex.Message}");
reJson.code = 40005;
reJson.message = "统一下单失败,请联系管理员!";
return reJson;
}
}
#endregion
}
}
+84
View File
@@ -5,3 +5,87 @@
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>
<script src="~/js/md5.min.js"></script>
<script>
//获取随机数
function randomNum(minNum, maxNum) {
switch (arguments.length) {
case 1:
return parseInt(Math.random() * minNum + 1, 10);
break;
case 2:
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
break;
default:
return 0;
break;
}
}
//排序
function sortObject(obj) {
//console.log(typeof (obj) == "object")
if (typeof (obj) == "object") {
let newObj = {}
Object.keys(obj).sort().map(x => {
//console.log(x);
newObj[x] = obj[x];
})
//console.log("new:", newObj);
return newObj;
}
}
//签名数组
function mySignObject(obj) {
//我的签名,先加入两个参数,一个是时间戳,一个是随机字符
//然后排序,取出所有值,拼接在一起,然后md5一次得到 signature ,然后再放到对象后面
if (typeof (obj) == "object") {
let timeStamp = new Date().getTime();
let random = randomNum(100000, 999999);
obj.timeStamp = timeStamp;
obj.random = random;
let newObj = sortObject(obj);
//console.log('处理后:',newObj);
//拼接
let strVal = '';
Object.keys(newObj).sort().map(x => {
strVal += newObj[x];
})
console.log('拼接字符',strVal);
//生成签名
let signature = md5(strVal + "comcms");
newObj.signature = signature;
return newObj;
//console.log(newObj);
}
}
//生成query验签
function createQuerySign(obj) {
if (typeof (obj) == "object") {
let sign = mySignObject(obj);
if (sign) {
let queryStr = '';
Object.keys(sign).sort().map(x => {
//console.log(x);
queryStr += x + "=" + sign[x] + "&";
});
//console.log('拼接:',queryStr);
if (queryStr != '') {
//清除最后一个&
queryStr = '?' + queryStr.substr(0, queryStr.length - 1);
}
return queryStr;
}
else {
return '';
}
} else {
return '';
}
}
var q = { id: 1 };
//var str = mySignObject(q);
var strRe = createQuerySign(q);
console.log(strRe);
</script>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 108 KiB

+280
View File
@@ -0,0 +1,280 @@
/*
* JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/* global define */
;(function ($) {
'use strict'
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safeAdd (x, y) {
var lsw = (x & 0xffff) + (y & 0xffff)
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
return (msw << 16) | (lsw & 0xffff)
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bitRotateLeft (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt))
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5cmn (q, a, b, x, s, t) {
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)
}
function md5ff (a, b, c, d, x, s, t) {
return md5cmn((b & c) | (~b & d), a, b, x, s, t)
}
function md5gg (a, b, c, d, x, s, t) {
return md5cmn((b & d) | (c & ~d), a, b, x, s, t)
}
function md5hh (a, b, c, d, x, s, t) {
return md5cmn(b ^ c ^ d, a, b, x, s, t)
}
function md5ii (a, b, c, d, x, s, t) {
return md5cmn(c ^ (b | ~d), a, b, x, s, t)
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binlMD5 (x, len) {
/* append padding */
x[len >> 5] |= 0x80 << (len % 32)
x[((len + 64) >>> 9 << 4) + 14] = len
var i
var olda
var oldb
var oldc
var oldd
var a = 1732584193
var b = -271733879
var c = -1732584194
var d = 271733878
for (i = 0; i < x.length; i += 16) {
olda = a
oldb = b
oldc = c
oldd = d
a = md5ff(a, b, c, d, x[i], 7, -680876936)
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586)
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819)
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330)
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897)
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426)
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341)
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983)
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416)
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417)
c = md5ff(c, d, a, b, x[i + 10], 17, -42063)
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162)
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682)
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101)
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290)
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329)
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510)
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632)
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713)
b = md5gg(b, c, d, a, x[i], 20, -373897302)
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691)
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083)
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335)
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848)
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438)
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690)
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961)
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501)
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467)
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784)
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473)
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734)
a = md5hh(a, b, c, d, x[i + 5], 4, -378558)
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463)
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562)
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556)
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060)
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353)
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632)
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640)
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174)
d = md5hh(d, a, b, c, x[i], 11, -358537222)
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979)
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189)
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487)
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835)
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520)
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651)
a = md5ii(a, b, c, d, x[i], 6, -198630844)
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415)
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905)
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055)
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571)
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606)
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523)
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799)
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359)
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744)
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380)
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649)
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070)
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379)
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259)
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551)
a = safeAdd(a, olda)
b = safeAdd(b, oldb)
c = safeAdd(c, oldc)
d = safeAdd(d, oldd)
}
return [a, b, c, d]
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr (input) {
var i
var output = ''
var length32 = input.length * 32
for (i = 0; i < length32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff)
}
return output
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl (input) {
var i
var output = []
output[(input.length >> 2) - 1] = undefined
for (i = 0; i < output.length; i += 1) {
output[i] = 0
}
var length8 = input.length * 8
for (i = 0; i < length8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32)
}
return output
}
/*
* Calculate the MD5 of a raw string
*/
function rstrMD5 (s) {
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8))
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstrHMACMD5 (key, data) {
var i
var bkey = rstr2binl(key)
var ipad = []
var opad = []
var hash
ipad[15] = opad[15] = undefined
if (bkey.length > 16) {
bkey = binlMD5(bkey, key.length * 8)
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 0x36363636
opad[i] = bkey[i] ^ 0x5c5c5c5c
}
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex (input) {
var hexTab = '0123456789abcdef'
var output = ''
var x
var i
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i)
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)
}
return output
}
/*
* Encode a string as utf-8
*/
function str2rstrUTF8 (input) {
return unescape(encodeURIComponent(input))
}
/*
* Take string arguments and return either raw or hex encoded strings
*/
function rawMD5 (s) {
return rstrMD5(str2rstrUTF8(s))
}
function hexMD5 (s) {
return rstr2hex(rawMD5(s))
}
function rawHMACMD5 (k, d) {
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d))
}
function hexHMACMD5 (k, d) {
return rstr2hex(rawHMACMD5(k, d))
}
function md5 (string, key, raw) {
if (!key) {
if (!raw) {
return hexMD5(string)
}
return rawMD5(string)
}
if (!raw) {
return hexHMACMD5(key, string)
}
return rawHMACMD5(key, string)
}
if (typeof define === 'function' && define.amd) {
define(function () {
return md5
})
} else if (typeof module === 'object' && module.exports) {
module.exports = md5
} else {
$.md5 = md5
}
})(this)
+2
View File
@@ -0,0 +1,2 @@
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"function"==typeof define&&define.amd?define(function(){return A}):"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this);
//# sourceMappingURL=md5.min.js.map