This commit is contained in:
ky_sunl
2021-04-22 13:37:25 +00:00
parent 575a22954f
commit d1c9e5a71e
699 changed files with 1062425 additions and 40640 deletions

34
Web/src/util/des/index.js Normal file
View File

@@ -0,0 +1,34 @@
import {
TripleDES,
enc,
mode,
pad
} from 'crypto-js';
const KEY = process.env.VUE_APP_DEV_KEY;
const key = enc.Utf8.parse(KEY);
//TripleDES加密
const encryptByDES = (message) => {
let encrypted = TripleDES.encrypt(message, key, {
mode: mode.ECB,
padding: pad.Pkcs7
});
return encrypted.toString();
}
//TripleDES解密
const decryptByDES = (ciphertext) => {
let decrypted = TripleDES.decrypt({
ciphertext: enc.Base64.parse(ciphertext)
}, key, {
mode: mode.ECB,
});
const value = decrypted.toString(enc.Utf8);
return value;
}
export {
encryptByDES,
decryptByDES
}