mirror of
https://github.com/vastxie/99AI.git
synced 2025-11-13 12:13:43 +08:00
NineAI 2.4.2
This commit is contained in:
26
dist/common/utils/base.js
vendored
Normal file
26
dist/common/utils/base.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decrypt = exports.encrypt = void 0;
|
||||
const crypto = require("crypto");
|
||||
const encryptionKey = 'bf3c116f2470cb4che9071240917c171';
|
||||
const initializationVector = '518363fh72eec1v4';
|
||||
const algorithm = 'aes-256-cbc';
|
||||
function encrypt(text) {
|
||||
const cipher = crypto.createCipheriv(algorithm, encryptionKey, initializationVector);
|
||||
let encrypted = cipher.update(text, 'utf8', 'base64');
|
||||
encrypted += cipher.final('base64');
|
||||
return encrypted;
|
||||
}
|
||||
exports.encrypt = encrypt;
|
||||
function decrypt(text) {
|
||||
try {
|
||||
const decipher = crypto.createDecipheriv(algorithm, encryptionKey, initializationVector);
|
||||
let decrypted = decipher.update(text, 'base64', 'utf8');
|
||||
decrypted += decipher.final('utf8');
|
||||
return decrypted;
|
||||
}
|
||||
catch (error) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
exports.decrypt = decrypt;
|
||||
Reference in New Issue
Block a user