update .gitignore
This commit is contained in:
@@ -1,34 +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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user