<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>庆亮的博客-webgame架构 &#187; md5</title>
	<atom:link href="http://www.qingliangcn.com/tag/md5/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.qingliangcn.com</link>
	<description>关注LAMP&#124;PHP源代码分析&#124;web架构&#124;PHP扩展&#124;Erlang&#124;服务端架构</description>
	<lastBuildDate>Fri, 10 Jun 2011 04:10:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Erlang中计算16位的MD5字符串</title>
		<link>http://www.qingliangcn.com/2010/01/erlang%e4%b8%ad%e8%ae%a1%e7%ae%9716%e4%bd%8d%e7%9a%84md5%e5%ad%97%e7%ac%a6%e4%b8%b2/</link>
		<comments>http://www.qingliangcn.com/2010/01/erlang%e4%b8%ad%e8%ae%a1%e7%ae%9716%e4%bd%8d%e7%9a%84md5%e5%ad%97%e7%ac%a6%e4%b8%b2/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 02:55:07 +0000</pubDate>
		<dc:creator>庆亮</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[md5]]></category>

		<guid isPermaLink="false">http://www.nd21.com/?p=213</guid>
		<description><![CDATA[&#160; erlang的bif中自带了md5计算函数，但是结果却是二进制的，即使转成list，也是10进制表示，google了一下得到一段代码用于获得字符串形式的md5结果（16位）： md5(S)&#160;-&#62;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Md5_bin&#160;=&#160;&#160;erlang:md5(S),&#160; Md5_list&#160;=&#160;binary_to_list(Md5_bin),&#160; lists:flatten(list_to_hex(Md5_list)).&#160; &#160; list_to_hex(L)&#160;-&#62;&#160; lists:map(fun(X)&#160;-&#62;&#160;int_to_hex(X)&#160;end,&#160;L).&#160; &#160; int_to_hex(N)&#160;when&#160;N&#160;&#60;&#160;256&#160;-&#62;&#160; [hex(N&#160;div&#160;16),&#160;hex(N&#160;rem&#160;16)].&#160; hex(N)&#160;when&#160;N&#160;&#60;&#160;10&#160;-&#62;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;$0+N;&#160; hex(N)&#160;when&#160;N&#160;&#62;=&#160;10,&#160;N&#160;&#60;&#160;16&#160;-&#62;&#160;&#160;&#160;&#160;&#160;&#160; $a&#160;+&#160;(N-10). 英文链接&#160;&#160;http://sacharya.com/md5-in-erlang/]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; ">erlang<font face="宋体">的</font><font face="Courier New">bif</font><font face="宋体">中自带了</font><font face="Courier New">md5</font><font face="宋体">计算函数，但是结果却是二进制的，即使转成</font><font face="Courier New">list</font><font face="宋体">，也是</font><font face="Courier New">10</font><font face="宋体">进制表示，</font><font face="Courier New">google</font><font face="宋体">了一下得到一段代码用于获得字符串形式的</font><font face="Courier New">md5</font><font face="宋体">结果（</font><font face="Courier New">16</font><font face="宋体">位）：</font></span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'宋体'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">md5(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">S</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Md5_bin</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;=&nbsp;&nbsp;erlang:md5(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">S</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">),&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Md5_list</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;=&nbsp;binary_to_list(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Md5_bin</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">),&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">lists:flatten(list_to_hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">Md5_list</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">))</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">list_to_hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">L</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">lists:map(</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">fun</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">X</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;-&gt;&nbsp;int_to_hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">X</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">end</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">L</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">int_to_hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">when</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&lt;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">256</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;-&gt;&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="text-indent:36.0000pt; margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">[hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">div</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">16</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">),&nbsp;hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">rem</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">16</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)]</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">when</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&lt;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">10</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;-&gt;&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$0+</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">;&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">hex(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(160,32,240); font-weight:bold; font-size:10.0000pt; font-family:'Courier New'; ">when</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&gt;=&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">10</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">,&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;&lt;&nbsp;</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">16</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">$a&nbsp;+&nbsp;(</span><span style="mso-spacerun:'yes'; color:rgb(184,134,11); font-size:10.0000pt; font-family:'Courier New'; ">N</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">-</span><span style="mso-spacerun:'yes'; color:rgb(90,90,180); font-size:10.0000pt; font-family:'Courier New'; ">10</span><span style="mso-spacerun:'yes'; color:rgb(0,0,0); font-size:10.0000pt; font-family:'Courier New'; ">)</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; ">.</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'Courier New'; "><o:p></o:p></span></p>
<p class="p0" style="margin-bottom:0pt; margin-top:0pt; "><span style="mso-spacerun:'yes'; font-size:10.0000pt; font-family:'Times New Roman'; ">英文链接</span><span style="mso-spacerun:'yes'; color:rgb(0,0,255); font-size:10.0000pt; font-family:'宋体'; ">&nbsp;&nbsp;http://sacharya.com/md5-in-erlang/</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.qingliangcn.com/2010/01/erlang%e4%b8%ad%e8%ae%a1%e7%ae%9716%e4%bd%8d%e7%9a%84md5%e5%ad%97%e7%ac%a6%e4%b8%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>


