添加对String 加密与解密

This commit is contained in:
Leo
2020-05-21 22:56:59 +08:00
parent 373fa60819
commit 5d013770cd
28 changed files with 31995 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
const encrypt = require('encryptjs');
cc.Class({
extends: cc.Component,
properties: {
label: {
default: null,
type: cc.Label
},
// defaults, set visually when attaching this script to the Canvas
text: 'Hello, World!'
},
// use this for initialization
onLoad: function () {
this.label.string = this.text;
let abc = 'aaaaaaaaaaa';
let key = 'key';
let encryStr = encrypt.encrypt(abc, key, 256);
console.log('abc=', encryStr);
let decryStr = encrypt.decrypt(encryStr, key, 256);
console.log('abc', decryStr);
},
// called every frame
update: function (dt) {
},
});