码迷,mamicode.com
首页 > 其他好文 > 详细

aes加密码

时间:2018-01-27 11:26:57      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:pre   SHA256   sha1   asc   gpo   html   密码   blog   .sh   

js地址   
https://github.com/yves8888/crypto-js 下面src
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CryptoJS</title> <script src="js/CryptoJS%20v3.1.2/components/core.js"></script> <script src="js/CryptoJS%20v3.1.2/components/md5.js"></script> <script src="js/CryptoJS%20v3.1.2/components/evpkdf.js"></script> <script src="js/CryptoJS%20v3.1.2/components/enc-base64.js"></script> <script src="js/CryptoJS%20v3.1.2/components/cipher-core.js"></script> <script src="js/CryptoJS%20v3.1.2/components/aes.js"></script> <script src="js/CryptoJS%20v3.1.2/components/hmac.js"></script> <script src="js/CryptoJS%20v3.1.2/components/sha1.js"></script> <script src="js/CryptoJS%20v3.1.2/components/sha256.js"></script> </head> <body> <div id="content"></div> <script> var md5 = CryptoJS.MD5("Message").toString(CryptoJS.enc.Hex); console.log("md5 = %s", md5); var sHA1 = CryptoJS.SHA1("Message").toString(CryptoJS.enc.Hex); console.log("sHA1 = %s", sHA1); var sHA256 = CryptoJS.SHA256("Message").toString(CryptoJS.enc.Hex); console.log("sHA256 = %s", sHA256); var hmacMD5 = CryptoJS.HmacMD5("Message", "Secret Passphrase").toString(CryptoJS.enc.Hex); console.log("hmacMD5 = %s", hmacMD5); var hmacSHA1 = CryptoJS.HmacSHA1("Message", "Secret Passphrase").toString(CryptoJS.enc.Hex); console.log("hmacSHA1 = %s", hmacSHA1); var aesEncrypt = CryptoJS.AES.encrypt("Message", "Secret Passphrase"); console.log("aesEncrypt = %s", aesEncrypt.iv.toString(CryptoJS.enc.Hex)); var aesDecrypt = CryptoJS.AES.decrypt(aesEncrypt, "Secret Passphrase"); console.log("aesDecrypt = %s", aesDecrypt.toString(CryptoJS.enc.Utf8)); // base64 encrypt var rawStr = "hello world!"; var wordArray = CryptoJS.enc.Utf8.parse(rawStr); var base64 = CryptoJS.enc.Base64.stringify(wordArray); console.log(‘base64Encrypt = ‘, base64); // base64 decrypt var parsedWordArray = CryptoJS.enc.Base64.parse(base64); var parsedStr = parsedWordArray.toString(CryptoJS.enc.Utf8); console.log(‘base64Decrypt = ‘,parsedStr); </script> </body> </html>

<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>core.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>md5.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>evpkdf.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>enc-base64.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>cipher-core.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>aes.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>hmac.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>sha1.js"></script>
<script src="<?php echo base_url(‘themes/mall/js/cryptojs/‘);?>sha256.js"></script>

<script type="text/javascript">

var aesEncrypt = CryptoJS.AES.encrypt("Message", "Secret Passphrase");
console.log("aesEncrypt = %s", aesEncrypt.iv.toString(CryptoJS.enc.Hex));

var aesDecrypt = CryptoJS.AES.decrypt(aesEncrypt, "Secret Passphrase");
console.log("aesDecrypt = %s", aesDecrypt.toString(CryptoJS.enc.Utf8));

</script>

  

aes加密码

标签:pre   SHA256   sha1   asc   gpo   html   密码   blog   .sh   

原文地址:https://www.cnblogs.com/php-linux/p/8364875.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!