| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, oops, StorageSecuritySimple, _crd;
- function _reportPossibleCrUseOfoops(extras) {
- _reporterNs.report("oops", "../../Oops", _context.meta, extras);
- }
- function _reportPossibleCrUseOfIStorageSecurity(extras) {
- _reporterNs.report("IStorageSecurity", "./StorageManager", _context.meta, extras);
- }
- _export("StorageSecuritySimple", void 0);
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- }, function (_unresolved_2) {
- oops = _unresolved_2.oops;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "386e3+fu+RJB5VSgow0kwS4", "StorageSecuritySimple", undefined);
- /**
- * 本地存储加密
- * 优点:
- * 1、代码体积小
- * 2、不依赖第三方库,使用这套方案可删除
- * StorageSecurityCrypto.ts
- * EncryptUtil.ts
- * package.json 中的crypto依赖减小包体
- *
- * 缺点:
- * 1、加密强度小
- */
- _export("StorageSecuritySimple", StorageSecuritySimple = class StorageSecuritySimple {
- constructor() {
- this.secretkey = null;
- var key = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
- error: Error()
- }), oops) : oops).config.game.localDataKey;
- var iv = (_crd && oops === void 0 ? (_reportPossibleCrUseOfoops({
- error: Error()
- }), oops) : oops).config.game.localDataIv;
- this.secretkey = key + iv;
- }
- encrypt(str) {
- var er = '';
- for (var i = 0; i < str.length; i++) {
- er += String.fromCharCode(str.charCodeAt(i) ^ this.secretkey.charCodeAt(i % this.secretkey.length));
- }
- return er;
- }
- decrypt(str) {
- var dr = '';
- for (var i = 0; i < str.length; i++) {
- dr += String.fromCharCode(str.charCodeAt(i) ^ this.secretkey.charCodeAt(i % this.secretkey.length));
- }
- return dr;
- }
- encryptKey(str) {
- return this.encrypt(str);
- }
- });
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=3590dca32eba901dae88884d0be28d77a1d1b864.js.map
|