小程序模板网

微信小程序 MD5js使用方法,请求接口轮播图

2018-02-06 寸白军

一:MD5 方法js

更多md5相关内容,可以查看此帖:MD5加密中文的结果不一致 
生成的文件可以放在 utils文件中哦!!!

 

  1. /*
  2. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  3. * Digest Algorithm, as defined in RFC 1321.
  4. * Version 1.1 Copyright (C) Paul Johnston 1999 - 2002.
  5. * Code also contributed by Greg Holt
  6. * See http://pajhome.org.uk/site/legal.html for details.
  7. */
  8.  
  9. /*
  10. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  11. * to work around bugs in some JS interpreters.
  12. */
  13. function safe_add(x, y)
  14. {
  15. var lsw = (x & 0xFFFF) + (y & 0xFFFF)
  16. var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
  17. return (msw << 16) | (lsw & 0xFFFF)
  18. }
  19.  
  20. /*
  21. * Bitwise rotate a 32-bit number to the left.
  22. */
  23. function rol(num, cnt)
  24. {
  25. return (num << cnt) | (num >>> (32 - cnt))
  26. }
  27.  
  28. /*
  29. * These functions implement the four basic operations the algorithm uses.
  30. */
  31. function cmn(q, a, b, x, s, t)
  32. {
  33. return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
  34. }
  35. function ff(a, b, c, d, x, s, t)
  36. {
  37. return cmn((b & c) | ((~b) & d), a, b, x, s, t)
  38. }
  39. function gg(a, b, c, d, x, s, t)
  40. {
  41. return cmn((b & d) | (c & (~d)), a, b, x, s, t)
  42. }
  43. function hh(a, b,


易优小程序(企业版)+灵活api+前后代码开源 码云仓库:starfork
本文地址:https://www.eyoucms.com/wxmini/doc/course/21635.html 复制链接 如需定制请联系易优客服咨询:800182392 点击咨询
QQ在线咨询