网安:修改手机存储
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user