JavaScript MD5 Library

jopen 13年前
     <p>这是一个纯 JavaScript 实现的 MD5 加密库。</p>    <p>使用方法:</p>    <p style="background:#000;"><span style="font-family:monospace;"><span style="color:#00ffff;"><</span><span style="color:#ffff00;">script</span><span style="color:#00ffff;"> </span><span style="color:#00ff00;">type</span><span style="color:#00ffff;">=</span><span style="color:#ff6060;">"text/javascript"</span><span style="color:#00ffff;"> </span><span style="color:#00ff00;">src</span><span style="color:#00ffff;">=</span><span style="color:#ff6060;">"md5.js"</span><span style="color:#00ffff;">></span><span style="color:#00ffff;"></</span><span style="color:#ffff00;">script</span><span style="color:#00ffff;">></span><br /> <span style="color:#00ffff;"><</span><span style="color:#ffff00;">script</span><span style="color:#00ffff;"> </span><span style="color:#00ff00;">type</span><span style="color:#00ffff;">=</span><span style="color:#ff6060;">"text/javascript"</span><span style="color:#00ffff;"> ></span><br /> <span style="color:#8080ff;">// quick test</span><br /> <span style="color:#00ffff;">var</span><span style="color:#ff40ff;"> input1 = </span><span style="color:#ff6060;">"ABC"</span><span style="color:#ff40ff;">;</span><br /> <span style="color:#00ffff;">var</span><span style="color:#ff40ff;"> input2 = </span><span style="color:#00ffff;">[</span><span style="color:#ff6060;">"A"</span><span style="color:#ff40ff;">,</span><span style="color:#ff6060;">"B"</span><span style="color:#ff40ff;">,</span><span style="color:#ff6060;">"C"</span><span style="color:#00ffff;">]</span><span style="color:#ff40ff;">;</span><br /> <span style="color:#00ffff;">var</span><span style="color:#ff40ff;"> input3 = </span><span style="color:#00ffff;">[</span>0x41<span style="color:#ff40ff;">, </span>0x42<span style="color:#ff40ff;">, </span>0x43<span style="color:#00ffff;">]</span><span style="color:#ff40ff;">;</span><br /> <span style="color:#ffff00;">alert</span>(<span style="color:#ff40ff;">faultylabs.MD5</span>(<span style="color:#ff40ff;">input1</span>)<span style="color:#ff40ff;"> == </span><span style="color:#ff6060;">"902FBDD2B1DF0C4F70B4A5D23525E932"</span>)<span style="color:#ff40ff;">;</span><br /> <span style="color:#ffff00;">alert</span>(<span style="color:#ff40ff;">faultylabs.MD5</span>(<span style="color:#ff40ff;">input2</span>)<span style="color:#ff40ff;"> == </span><span style="color:#ff6060;">"902FBDD2B1DF0C4F70B4A5D23525E932"</span>)<span style="color:#ff40ff;">;</span><br /> <span style="color:#ffff00;">alert</span>(<span style="color:#ff40ff;">faultylabs.MD5</span>(<span style="color:#ff40ff;">input3</span>)<span style="color:#ff40ff;"> == </span><span style="color:#ff6060;">"902FBDD2B1DF0C4F70B4A5D23525E932"</span>)<span style="color:#ff40ff;">;</span><br /> <br /> <span style="color:#00ffff;"></</span><span style="color:#ffff00;">script</span><span style="color:#00ffff;">></span></span></p>    <br />    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1328022058030" target="_blank">http://www.open-open.com/lib/view/home/1328022058030</a></p>