js加密函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38


/*
// md5摘要算法
const CryptoJS = require('crypto-js');
// 原始数据
const data = '123456';
// 生成MD5摘要
const md5Digest = CryptoJS.MD5(data).toString();
console.log(md5Digest);
// e10adc3949ba59abbe56e057f20f883e
// e10adc3949ba59abbe56e057f20f883e*/


// aes-128算法

const CryptoJS = require("crypto-js")

// 密钥(128位,16字节)
var key = CryptoJS.enc.Utf8.parse('0123456789abcdef');

// 初始化向量(IV)(128位,16字节)
var iv = CryptoJS.enc.Utf8.parse('1234567890abcdef');

// 待加密的数据
var plaintext = 'Hello, yuan!';

// 进行AES-128加密,使用CBC模式和PKCS7填充
var encrypted = CryptoJS.AES.encrypt(plaintext, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});

// 获取加密后的密文
var ciphertext = encrypted.toString();

console.log(ciphertext);

js加密函数
https://tsy244.github.io/2025/06/10/js逆向/js加密函数/
Author
August Rosenberg
Posted on
June 10, 2025
Licensed under