使用js_md5加密密碼

來源:互聯網
上載者:User

標籤:github   ges   cti   訪問   lan   方式   har   title   get   

為什麼在傳輸過程中要用md5對密碼進行加密?

眾所周知,我們在表單中的輸入框輸入了密碼後,如果採用ajax的post或者get方式提交資料,在瀏覽器的newwork中就可以看到我們向後台傳輸的內容,其他的常值內容直接提交都沒問題,如果密碼在傳輸的過程中也能被別人看見。

如果傳輸被攔截,那麼密碼就完全暴露給別人了,安全性存在極大的隱患。

所以,在傳輸過程中,推薦使用加密傳輸。

前端單個js_md5執行個體代碼
<!DOCTYPE HTML><html>    <head>    <meta charset="utf-8">    <title>md5加密</title>    <script type="text/ecmascript" src="md5.js"></script>    <script type="text/javascript">     var hash = hex_md5("123dafd");     alert(hash)    </script></head><body></body></html>

前端md5加密參考文檔

nodejs服務端單個md5加密代碼
var crypto = require(‘crypto‘);exports.md5 = function (str) {    var md5sum = crypto.createHash(‘md5’);    md5sum.update(str);    str = md5sum.digest(‘hex’);    return str;};

服務端md5加密參考

 

完整前端、後台例子,請訪問 https://github.com/ming25/js_md5

使用js_md5加密密碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.