Skip to content

Instantly share code, notes, and snippets.

@chiyi4488
Last active August 3, 2019 04:07
Show Gist options
  • Save chiyi4488/903dee5ceb3d7a3a2a9e73f5f7da8c03 to your computer and use it in GitHub Desktop.
Save chiyi4488/903dee5ceb3d7a3a2a9e73f5f7da8c03 to your computer and use it in GitHub Desktop.
Blogger加密文章
<!--Design by Cotpear _Start-->
請輸入密碼,以顯示內容。
<input class="form-control" id="pwd" type="text" />
<button class="btn btn-info" id="submitPwd" style="text-align: center;">解密</button>
<script>
var code="將您的密文貼至於此"
$(() => {
$("#submitPwd").click(() => {
try {
$("#result").html(
decodeURIComponent(
CryptoJS.AES.decrypt(
code,
$("#pwd").val()
).toString(CryptoJS.enc.Utf8)
)
)
} catch (e) {
alert('密碼錯誤')
}
setTimeout(() => {
if ($("#result").html() == "") {
alert('密碼錯誤')
}
}, 500)
})
})
</script>
<div id="result">
</div>
<!--Design by Cotpear _End-->
@hsuan1117
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment