当前位置:网站首页>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
边栏推荐
- Restcloud ETL extraction de données de table de base de données dynamique
- TCP congestion control details | 1 summary
- [cloud native] codeless IVX editor programmable by "everyone"
- [async/await] - the final solution of asynchronous programming
- RestCloud ETL解决shell脚本参数化
- Kubernetes的pod调度
- clustermeet
- R语言dplyr包summarise_at函数计算dataframe数据中多个数据列(通过向量指定)的均值和中位数、指定na.rm参数配置删除缺失值
- Is it safe to open an online stock account? Somebody give me an answer
- R language uses the aggregate function of epidisplay package to split numerical variables into different subsets based on factor variables, calculate the summary statistics of each subset, and use agg
猜你喜欢

RestCloud ETL解决shell脚本参数化

数据库-序列

vsomeip3 双机通信文件配置

qt下多个子控件信号槽绑定方法

重磅白皮书发布,华为持续引领未来智慧园区建设新模式

RestCloud ETL抽取动态库表数据实践

【TcaplusDB知识库】TcaplusDB系统用户组介绍

Bank of Beijing x Huawei: network intelligent operation and maintenance tamps the base of digital transformation service

【TcaplusDB知识库】TcaplusDB单据受理-建表审批介绍

Get the intersection union difference set of two dataframes
随机推荐
vue中缓存页面 keepAlive使用
10 minutes to understand bim+gis fusion, common BIM data formats and characteristics
Restcloud ETL extracting dynamic library table data
R语言epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布、使用cex.X.axis参数指定X轴轴刻度数值标签字体的大小
Unity C # e-learning (10) -- unitywebrequest (1)
Advanced operation of MySQL database basic SQL statement tutorial
Informatics Olympiad all in one 1400: count the number of words (string matching)
SAP 销售数据 实际发货数据导出 销量
TCP congestion control details | 1 summary
Pytorch深度学习代码技巧
杜老师说网站更新图解
qt下多个子控件信号槽绑定方法
Sorted out a batch of script standard function modules (version 2021)
It's natural for the landlord to take the rent to repay the mortgage
R语言dplyr包bind_rows函数把两个dataframe数据的行纵向(竖直)合并起来、最终行数为原来两个dataframe行数的加和(Combine Data Frames)
Idea shortcut key
Smoothing data using convolution
Pod scheduling of kubernetes
The heavyweight white paper was released. Huawei continues to lead the new model of smart park construction in the future
R语言dplyr包summarise_at函数计算dataframe数据中多个数据列(通过向量指定)的均值和中位数、指定na.rm参数配置删除缺失值