JavaScript MD5

概論

The MD4, MD5 and SHA-1 algorithms are secure hash functions. They take a string input, and produce a fixed size number - 128 bits for MD4 and MD5; 160 bits for SHA-1. This number is a hash of the input - a small change in the input results in a substantial change in the output. The functions are thought to be secure, in the sense that it would require an enormous amount of computing power to find a string which hashes to a chosen value. In others words, there's no way to decrypt a secure hash. The uses of secure hashes include digital signatures and challenge hash authentication. This document is a good introduction to hashes

簡單的說,就是把一個字串輸入,變成一個固定長度的輸出, 可以應用在驗證上, 而且要從輸出,去推出輸入字串 相當困難

Demonstration

輸入
演算法
輸出

hex_md4("vigor") = "7a34d6e9d61075a37c621b917ae98726"
hex_md5("televison") = "285045280119e794864fbfceb798ed1e"
hex_sha1("vigor televison") = "889227f10a93118ebe6cf3ef4ed81e0ad433b044"