微信小程序 - AES、RSA、SHA256、MD5、base64封装使用

GitHub Demo 地址: jh-weapp-demo 实现一些常用效果、封装通用组件和工具类

在微信小程序使用加密算法,需要对js中使用的对称加密算法需要进行改造,demo中对每一种加密方法进行封装,最终通过encryptUtils.js 工具类进行二次封装,然后统一调用。源码请查看demo

在这里插入图片描述

在线AES网站 : https://tool.lmeee.com/jiami/aes
在线RSA网站 : https://www.bejson.com/enc/rsa/

用法:


const EncryptUtils = require('../../utils/encrypt/encryptUtils')

EncryptUtils.AESEncrypt('123')
EncryptUtils.RSAEncrypt('123')

EncryptUtils.SHA256('123')
EncryptUtils.MD5('123')

EncryptUtils.Base64EnCode('123')
EncryptUtils.Base64DeCode('123')

猜你喜欢

转载自blog.csdn.net/iotjin/article/details/119730883
今日推荐