小程序模板網(wǎng)

微信小程序 MD5js使用方法,請求接口輪播圖

發(fā)布時間:2018-02-06 15:44 所屬欄目:小程序開發(fā)教程

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


易優(yōu)小程序(企業(yè)版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://22321a.com/wxmini/doc/course/21635.html 復制鏈接 如需定制請聯(lián)系易優(yōu)客服咨詢:800182392 點擊咨詢
QQ在線咨詢