You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
// const crypto = require('crypto');
|
|
|
|
// // Key and IV generation for AES
|
|
// const algorithm = 'aes-256-cbc';
|
|
// const key = crypto.randomBytes(32); // 256-bit key
|
|
// console.log(key)
|
|
// const iv = crypto.randomBytes(16); // Initialization vector
|
|
// console.log(iv)
|
|
// // Encrypt function
|
|
// function encrypt(text) {
|
|
// const cipher = crypto.createCipheriv(algorithm, key, iv);
|
|
// let encrypted = cipher.update(text, 'utf8', 'hex');
|
|
// encrypted += cipher.final('hex');
|
|
// return encrypted;
|
|
// }
|
|
|
|
// // Decrypt function
|
|
// function decrypt(encryptedText) {
|
|
// const decipher = crypto.createDecipheriv(algorithm, key, iv);
|
|
// let decrypted = decipher.update(encryptedText, 'hex', 'utf8');
|
|
// decrypted += decipher.final('utf8');
|
|
// return decrypted;
|
|
// }
|
|
|
|
// // Example usage
|
|
// const textToEncrypt = 'Hello, World!';
|
|
// const encryptedText = encrypt(textToEncrypt);
|
|
// const decryptedText = decrypt(encryptedText);
|
|
|
|
// console.log('Text to Encrypt:', textToEncrypt);
|
|
// console.log('Encrypted Text:', encryptedText);
|
|
// console.log('Decrypted Text:', decryptedText);
|
|
|
|
|
|
console.log("Starting script...");
|
|
|
|
setTimeout(() => {
|
|
console.log("About to throw an error...");
|
|
1*p
|
|
}, 3000);
|
|
|
|
process.on("uncaughtException", (err) => {
|
|
console.error("Caught before exit:", err);
|
|
process.exit(1); // Ensure the process exits after logging
|
|
});
|