暫無描述

GlobalEncryptTool.js 525B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Created by zack on 2018/1/25.
  3. */
  4. import AES from 'crypto-js/aes'
  5. import CryptoJS from 'crypto-js'
  6. import MD5 from 'crypto-js/md5'
  7. const AESKey = '!23!LinkCampus->20i7~'
  8. const GlobalAESDeEncryptTool = {
  9. encrypt(text) {
  10. return AES.encrypt(text, AESKey).toString()
  11. },
  12. decrypt(text) {
  13. const bytes = AES.decrypt(text, AESKey);
  14. return bytes.toString(CryptoJS.enc.Utf8)
  15. }
  16. }
  17. const GlobalMD5EncryptTool = {
  18. encrypt(text) {
  19. return MD5(text) + ''
  20. }
  21. }
  22. export {
  23. GlobalAESDeEncryptTool,
  24. GlobalMD5EncryptTool
  25. }