代码如下
<!DOCTYPE html> <html> <head> <title>Md5加密</title> <script src="/style/v3/crypto-js/crypto-js.js?t=287"></script> </head> <body> <script> test(); function test() { var str = "abc"; var md5Result = CryptoJS.SHA256(str); console.log("SHA256 的结果是:" + md5Result); } </script> </body> </html>
结果是:
SHA256 的结果是:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad