RSA Implementation
code implementation of asymmetric(RSA) encryption with NodeJs
// write a code implementation of asymmetric(RSA) encryption with NodeJs
var crypto = require('crypto');
var fs = require('fs');
// var publicKey = '3r44ej'
var privateKey = '73e83w'
****Encryption Starts Here
var text = "Computer Science for Life!.";
var cipher = crypto.createCipher('aes-256-cbc', 'secret');
var encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex');
console.log("Encrypted text: " + encrypted);
****Decrypting Starts Here
var decipher = crypto.createDecipher('aes-256-cbc', 'secret');
var decrypted = decipher.update('238042f838ac38332c45c05d8dc8fc982b86116b1b2d09eaad9a41dd0f98732d', 'hex', 'utf8') + decipher.final('utf8');
console.log("Decrypted text: " + decrypted);
Cool?
Find my other codes on Github.com/gamer-snave