网安:修改手机存储

This commit is contained in:
luying
2021-04-09 10:43:53 +08:00
parent ad2b62d426
commit a02ee04a5b
11 changed files with 4504 additions and 213 deletions
+34
View File
@@ -10,6 +10,40 @@ import { findIndex } from 'underscore';
import { getWeekDate } from './timeUtil';
const randomName = require("chinese-random-name");
const moment = require('moment');
const crypto = require('crypto');
export function aesEncrypt(data, key, iv) {
const cipher = crypto.createCipheriv('aes-192-cbc', key, iv);
let crypted = cipher.update(data, 'utf8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
export function aesDecrypt(data, key, iv) {
const decipher = crypto.createDecipheriv('aes-192-cbc', key, iv);
let decrypted = decipher.update(data, 'hex', 'utf8');
decrypted += decipher.final('utf8');
return decrypted;
}
export function aesEncryptcfb(data, key, iv) {
console.log('****aesEncryptcfb', data)
const cipher = crypto.createCipheriv('aes-192-cfb', key, iv);
let crypted = cipher.update(data, 'utf8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
export function aesDecryptcfb(data, key, iv) {
if(data) {
const decipher = crypto.createDecipheriv('aes-192-cfb', key, iv);
let decrypted = decipher.update(data, 'hex', 'utf8');
decrypted += decipher.final('utf8');
return decrypted;
} else {
return ''
}
}
export function genCode(len) {
const chars = '123456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijklmnopqrstuvwxyz';