如何使用crypto.js进行md5、base64加密

今天小编给大家分享一下如何使用crypto.js进行md5、base64加密的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

编码转换工具

md5

import CryptoJS from "crypto-js";

const password = "1234qwer"; 
const md5 = CryptoJS.MD5(password).toString();

console.log(md5)

base64

import CryptoJS from "crypto-js";

const password = "1234qwer"; 
const utf8= CryptoJS.enc.Utf8.parse(password);
const base64 = CryptoJS.enc.Base64.stringify(utf8);

console.log(md5)

相关文章