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工作流
一个超现实和超现实的场景,在森林中心有一座蛇形的房子
一个红头发明亮眼睛的漂亮女人
一朵由琥珀制成的孤独美丽的玫瑰
一颗柔和的水晶金字塔ComfyUI工作流
一个熙熙攘攘的市场场景,里面摆满了南瓜
葡萄庄园白葡萄酒ComfyUI工作流
一幅骨架坐在公园的长椅上
一张由表情符号组成的照片ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

3D立体人物效果
css3画弹珠,可以滚动!
HTML5 Canvas 刻度尺
在线生成金属文字
会议人员60s签到倒计时插件
canvas经线动画走到效果
jquery做一个漂亮挂墙动态时钟










