nodejs如何利用3DES进行加密解密,下面web建站小编给大家简单介绍一下!
安装脚手架
npm install crypto
生成密钥
const crypto = require('crypto');
const key = crypto.randomBytes(24);
console.log(key.toString('hex'));
加密数据
const crypto = require('crypto');
const key = crypto.randomBytes(24);
const text = 'Hello, world!';
const cipher = crypto.createCipheriv('des-ede3', key, '');
let encrypted = cipher.update(text, 'utf8', 'hex');
encrypted += cipher.final('hex');
console.log(encrypted);
解密数据
const crypto = require('crypto');
const key = crypto.randomBytes(24);
const text = 'Hello, world!';
const cipher = crypto.createCipheriv('des-ede3', key, '');
let encrypted = cipher.update(text, 'utf8', 'hex');
encrypted += cipher.final('hex');
console.log(encrypted);
const decipher = crypto.createDecipheriv('des-ede3', key, '');
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
decrypted += decipher.final('utf8');
console.log(decrypted);
上面是“nodejs如何利用3DES加密解密”的全面内容,想了解更多关于 nodejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4503.html
workflows工作流
一个浑身皮毛看起来像丘巴卡的3d动漫人物
一群蚂蚁在路上忙碌着ComfyUI工作流
在白雪覆盖的广阔平原上两只可爱的小猫
梦幻中的一只猫咪ComfyUI工作流
一张超现实主义美女照片ComfyUI工作流
图生图工作流:粉红色梦幻家园comfyui工作流
一座巨大的野兽派建筑漂浮在热带风景中的贫民
在月球上穿着太空服的宇航员
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

HTML5 Canvas 刻度尺
css3做一个风雨雷电天气动态图标
利用html5+css3实现滚雪球效果(附代码)
css3搭积木叠加图形
如何利用svg做一个有趣的loading动画加载
iframe开发admin后台
canvas黑洞漩涡(canvas+js)
利用CSS3代码编写45款按钮效果














