b2540a809ee69f23e49106e7123b166bb5764c43.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // /*
  2. // * @Author: dgflash
  3. // * @Date: 2022-09-02 09:28:00
  4. // * @LastEditors: dgflash
  5. // * @LastEditTime: 2022-10-21 09:46:39
  6. // */
  7. // import CryptoES from "crypto-es";
  8. // /**
  9. // * CryptoES 加密库封装
  10. // * https://github.com/entronad/crypto-es
  11. // *
  12. // * 安装第三方库生效
  13. // * npm install -g yarn
  14. // * yarn add crypto-es
  15. // */
  16. // export class EncryptUtil {
  17. // private static key: string = null!;
  18. // private static iv: CryptoES.lib.WordArray = null!;
  19. // /**
  20. // * MD5加密
  21. // * @param msg 加密信息
  22. // */
  23. // static md5(msg: string): string {
  24. // return CryptoES.MD5(msg).toString();
  25. // }
  26. // /** 初始化加密库 */
  27. // static initCrypto(key: string, iv: string) {
  28. // this.key = key;
  29. // this.iv = CryptoES.enc.Hex.parse(iv);
  30. // }
  31. // /**
  32. // * AES 加密
  33. // * @param msg 加密信息
  34. // * @param key aes加密的key
  35. // * @param iv aes加密的iv
  36. // */
  37. // static aesEncrypt(msg: string, key: string, iv: string): string {
  38. // return CryptoES.AES.encrypt(
  39. // msg,
  40. // this.key,
  41. // {
  42. // iv: this.iv,
  43. // format: this.JsonFormatter
  44. // },
  45. // ).toString();
  46. // }
  47. // /**
  48. // * AES 解密
  49. // * @param str 解密字符串
  50. // * @param key aes加密的key
  51. // * @param iv aes加密的iv
  52. // */
  53. // static aesDecrypt(str: string, key: string, iv: string): string {
  54. // const decrypted = CryptoES.AES.decrypt(
  55. // str,
  56. // this.key,
  57. // {
  58. // iv: this.iv,
  59. // format: this.JsonFormatter
  60. // },
  61. // );
  62. // return decrypted.toString(CryptoES.enc.Utf8);
  63. // }
  64. // private static JsonFormatter = {
  65. // stringify: function (cipherParams: any) {
  66. // const jsonObj: any = { ct: cipherParams.ciphertext.toString(CryptoES.enc.Base64) };
  67. // if (cipherParams.iv) {
  68. // jsonObj.iv = cipherParams.iv.toString();
  69. // }
  70. // if (cipherParams.salt) {
  71. // jsonObj.s = cipherParams.salt.toString();
  72. // }
  73. // return JSON.stringify(jsonObj);
  74. // },
  75. // parse: function (jsonStr: any) {
  76. // const jsonObj = JSON.parse(jsonStr);
  77. // const cipherParams = CryptoES.lib.CipherParams.create(
  78. // { ciphertext: CryptoES.enc.Base64.parse(jsonObj.ct) },
  79. // );
  80. // if (jsonObj.iv) {
  81. // cipherParams.iv = CryptoES.enc.Hex.parse(jsonObj.iv)
  82. // }
  83. // if (jsonObj.s) {
  84. // cipherParams.salt = CryptoES.enc.Hex.parse(jsonObj.s)
  85. // }
  86. // return cipherParams;
  87. // },
  88. // };
  89. // }
  90. System.register(["cc"], function (_export, _context) {
  91. "use strict";
  92. var _cclegacy, _crd;
  93. return {
  94. setters: [function (_cc) {
  95. _cclegacy = _cc.cclegacy;
  96. }],
  97. execute: function () {
  98. _crd = true;
  99. _cclegacy._RF.push({}, "46d12Bx4JdKnIYHhcvNk6S1", "EncryptUtil", undefined);
  100. _cclegacy._RF.pop();
  101. _crd = false;
  102. }
  103. };
  104. });
  105. //# sourceMappingURL=b2540a809ee69f23e49106e7123b166bb5764c43.js.map