欢迎光临,了解微信小程序开发,就上易用通!

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

发布:2018-02-06 15:44浏览: 来源:网络 作者:cola

一: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 https://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,




免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。