level 3
CloudTown
楼主
程序:
function encrypt(plainText, password, iv) { const encrypted = CryptoJS.AES.encrypt(plainText, password, { iv: CryptoJS.enc.Hex.parse(iv) }).toString(); return encrypted; }
function encryptAndSend() {
const plainText = document.getElementById('textInput').value;
const key = document.getElementById('keyInput').value;
const iv = CryptoJS.SHA256(key).toString().substring(0, 32);
const encryptedText = encrypt(plainText, key, iv);

2023年11月19日 03点11分
1
function encrypt(plainText, password, iv) { const encrypted = CryptoJS.AES.encrypt(plainText, password, { iv: CryptoJS.enc.Hex.parse(iv) }).toString(); return encrypted; }
function encryptAndSend() {
const plainText = document.getElementById('textInput').value;
const key = document.getElementById('keyInput').value;
const iv = CryptoJS.SHA256(key).toString().substring(0, 32);
const encryptedText = encrypt(plainText, key, iv);
