当前位置:网站首页>Function: crypto JS encryption and decryption
Function: crypto JS encryption and decryption
2022-06-26 15:11:00 【[email protected]】
One 、 Demand background and crypto Realization principle
To be added
Two 、 Install and use
2.1、 install
yarn add crypto-js
2.2、 stay utils.js Introducing plug-ins
const CryptoJS = require('crypto-js')
2.3、utils.js In the document Encapsulation encryption 、 Decryption method
const key = CryptoJS.enc.Utf8.parse('xxxx_aes_v1_mweb')
// Decryption method
export function Decrypt(word) {
let decrypt = CryptoJS.AES.decrypt(word, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })
let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8)
return decryptedStr.toString()
}
// Encryption method
export function Encrypt(word) {
let srcs = CryptoJS.enc.Utf8.parse(word)
let encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })
return encrypted.toString()
}2.4、 Page using
2.4.1、 Introduce methods
import { Encrypt, Decrypt } from '@const/utils';
2.4.2、 Use
let EData = Encrypt(111111)
console.log('151', EData)
console.log('151', Decrypt(EData))2.4.3、 effect

2.5、 relevant
In many cases, when we talk about adding and resolving secrets, we will think of MD5,MD5 Is a hash algorithm , Can't encrypt or decrypt .
3、 ... and 、 Welcome to communicate and correct , Pay attention to me , Learning together
Four 、 Reference link :
crypto-js encryption 、 Decryption usage _deardanyang The blog of -CSDN Blog _crypto-js
Front end encryption and decryption Crypto.js - Nuggets
MD5 Is it encryption ?_Monster_ Take off blog -CSDN Blog _md5 Not encryption algorithm
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261451357797.html
边栏推荐
- 5张图诠释了容器网络
- Unity C # e-learning (10) -- unitywebrequest (1)
- Restcloud ETL extraction de données de table de base de données dynamique
- R语言dplyr包bind_rows函数把两个dataframe数据的行纵向(竖直)合并起来、最终行数为原来两个dataframe行数的加和(Combine Data Frames)
- Sorted out a batch of script standard function modules (version 2021)
- Unity C # e-learning (IX) -- wwwfrom
- NVIDIA SMI error
- R语言dplyr包intersect函数获取在两个dataframe中都存在的数据行、获取两个dataframe交叉的数据行
- 一键分析硬件/IO/全国网络性能脚本(强推)
- [solo π] ADB connects multiple mobile phones
猜你喜欢

使用 Abp.Zero 搭建第三方登录模块(二):服务端开发

Redis-集群

使用 Abp.Zero 搭建第三方登录模块(一):原理篇
![[cloud native] codeless IVX editor programmable by](/img/10/7c56e46df69be6be522a477b00ec05.png)
[cloud native] codeless IVX editor programmable by "everyone"

刷题笔记(十九)--二叉树:二叉搜索树的修改与构造

Program analysis and Optimization - 8 register allocation

Common operation and Principle Exploration of stream

Authoritative announcement on the recruitment of teachers in Yan'an University in 2022

Redis cluster

RestCloud ETL抽取動態庫錶數據實踐
随机推荐
Idea shortcut key
How to load the contour CAD drawing of the engineering coordinate system obtained by the designer into the new earth
HR export data Excel VBA
打新债注册开户安全吗,有没有什么风险?
Redis transaction and watch instruction
It's natural for the landlord to take the rent to repay the mortgage
SAP sales data actual shipment data export sales
功能:crypto-js加密解密
R语言epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布、使用cex.X.axis参数指定X轴轴刻度数值标签字体的大小
重磅白皮书发布,华为持续引领未来智慧园区建设新模式
【TcaplusDB知识库】TcaplusDB OMS业务人员权限介绍
Smoothing data using convolution
SAP 销售数据 实际发货数据导出 销量
【TcaplusDB知识库】TcaplusDB系统用户组介绍
English语法_形容词/副词3级 - 原级句型
redis集群的重新分片与ASK命令
数据库-序列
子查询的使用
710. random numbers in the blacklist
Get the intersection union difference set of two dataframes