crypto
const crypto = require('crypto');
// Encrypting data
const encryptedData = crypto.createCipher('aes-256-cbc', 'myPassword').update('Hello World').final('hex');
// Decrypting data
const decryptedData = crypto.createDecipher('aes-256-cbc', 'myPassword').update(encryptedData, 'hex').final('utf8');const crypto = require('crypto');
const hash = crypto.createHash('sha256').update('Hello World').digest('hex');const crypto = require('crypto');
const privateKey = crypto.createPrivateKey({
key: fs.readFileSync('private.pem'),
format: 'pem',
});
const signature = crypto.sign('sha256', Buffer.from('Hello World'), privateKey);