728x90
// INIT
var myString = "";
var myPassword = "";
// PROCESS
var encrypted = CryptoJS.AES.encrypt(myString, myPassword);
var decrypted = CryptoJS.AES.decrypt(myString, myPassword);
document.getElementById("demo0").innerHTML = myString;
document.getElementById("demo1").innerHTML = encrypted;
document.getElementById("demo2").innerHTML = decrypted;
document.getElementById("demo3").innerHTML = decrypted.toString(CryptoJS.enc.Utf8);
<html lang="es">
<head>
<meta charset="utf-8">
<title>CryptoJS Example</title>
<meta name="description" content="CryptoJs Example">
<meta name="author" content="Gabriel Porras">
<!--
https://cdnjs.com/libraries/crypto-js
-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
<!--[if lt IE 9]>
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
</body>
<strong><label>Original String:</label></strong>
<span id="demo0"></span>
<br>
<br>
<strong><label>Encrypted:</label></strong>
<span id="demo1"></span>
<br>
<br>
<strong><label>Decrypted:</label></strong>
<span id="demo2"></span>
<br>
<br>
<strong><label>String after Decryption:</label></strong>
<span id="demo3"></span>
<br />
<br />
<strong style="color: red;">CryptoJS is no longer maintained. Take a look of another JS Crypto Libraries in my <a href="https://github.com/gabrielizalo/JavaScript-Crypto-Libraries" target="_blank">GibHub List</a></strong>.
</html>
728x90
'자료' 카테고리의 다른 글
네이버 로그인 소스코드 (0) | 2023.04.06 |
---|---|
CryptoJS PHP 통신 (0) | 2023.03.23 |
winhttp.IWinHttpRequest::Option 속성 (1) | 2022.11.21 |
iTunes 자동 백업을 비활성화하는 방법 (0) | 2022.11.04 |
[COX/콕스] CK108 기계식 키보드 단축키 모음 (0) | 2022.10.09 |