📄 一个uuid生成算法的c语言实现 --- win32版本.mht
字号:
#000000"> {<BR> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000"> state[</SPAN><SPAN=20
style=3D"COLOR: #000000">4</SPAN><SPAN=20
style=3D"COLOR: =
#000000">]; &n=
bsp; </SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: #008000"> state (ABCD) </SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: =
#000000"><BR> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000"> count[</SPAN><SPAN=20
style=3D"COLOR: #000000">2</SPAN><SPAN=20
style=3D"COLOR: =
#000000">]; &n=
bsp; </SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000"> number of bits, modulo 2^64 (lsb&=
nbsp;first) </SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: =
#000000"><BR> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> buffer[</SPAN><SPAN=20
style=3D"COLOR: #000000">64</SPAN><SPAN=20
style=3D"COLOR: #000000">]; </SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: #008000"> input buffer </SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>} MD5_CTX;<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> MD5_init (MD5_CTX </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN style=3D"COLOR: =
#000000">);<BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> MD5_update (MD5_CTX </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN style=3D"COLOR: =
#000000">, </SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN style=3D"COLOR: =
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">str, unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000"> len);<BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> MD5_fini (unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN style=3D"COLOR: =
#000000">[</SPAN><SPAN=20
style=3D"COLOR: #000000">16</SPAN><SPAN=20
style=3D"COLOR: #000000">], MD5_CTX </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">);<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN style=3D"COLOR: =
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000"> MD5_sign (</SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN style=3D"COLOR: =
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">str, unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000"> len);<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#endif</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> /* _MD5_H__ */</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN></DIV></DIV>
<P> </P>
<DIV=20
style=3D"BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; =
BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: =
#e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; =
WIDTH: 95%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: =
windowtext 0.5pt solid">
<DIV><SPAN style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000"> <BR> * md5.c - Copyright 1997&nbs=
p;Lachlan Roche <BR> * =
- Modified by cheungmine, 2007-9-15<BR> </=
SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>#include </SPAN><SPAN=20
style=3D"COLOR: #000000"><</SPAN><SPAN=20
style=3D"COLOR: #000000">stdio.h</SPAN><SPAN=20
style=3D"COLOR: #000000">></SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>#include </SPAN><SPAN=20
style=3D"COLOR: #000000"><</SPAN><SPAN=20
style=3D"COLOR: #000000">stdlib.h</SPAN><SPAN=20
style=3D"COLOR: #000000">></SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>#include </SPAN><SPAN=20
style=3D"COLOR: #000000"><</SPAN><SPAN=20
style=3D"COLOR: #0000ff">string</SPAN><SPAN style=3D"COLOR: =
#000000">.h</SPAN><SPAN=20
style=3D"COLOR: #000000">></SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>#include </SPAN><SPAN=20
style=3D"COLOR: #000000"><</SPAN><SPAN=20
style=3D"COLOR: #000000">memory.h</SPAN><SPAN=20
style=3D"COLOR: #000000">></SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>#include </SPAN><SPAN=20
style=3D"COLOR: #000000">"</SPAN><SPAN style=3D"COLOR: =
#000000">md5.h</SPAN><SPAN=20
style=3D"COLOR: #000000">"</SPAN><SPAN style=3D"COLOR: =
#000000"><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> MD5STR_LEN =
32 </SPAN><SPAN=20
style=3D"COLOR: #000000"><BR><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>&nb=
sp; The remaining code is the referen=
ce MD5 code (md5c.c) from rfc1321<BR>  =
; MD5C.C - RSA Data Security, Inc., MD=
5 message-digest algorithm<BR><BR> Copyright&n=
bsp;(C) 1991-2, RSA Data Security, Inc. Cre=
ated 1991. All<BR> rights reserved.<BR><B=
R> License to copy and use this=
software is granted provided that it<BR>&n=
bsp; is identified as the "RSA Data&n=
bsp;Security, Inc. MD5 Message-Digest<BR>  =
;Algorithm" in all material mentioning or r=
eferencing this software<BR> or this =
;function.<BR><BR> License is also grante=
d to make and use derivative works pro=
vided<BR> that such works are identi=
fied as "derived from the RSA Data<BR> =
; Security, Inc. MD5 Message-Digest Algori=
thm" in all material<BR> mentioning =
or referencing the derived work.<BR><BR> &=
nbsp;RSA Data Security, Inc. makes no repre=
sentations concerning either<BR> the merc=
hantability of this software or the suitabi=
lity of this<BR> software for any&nb=
sp;particular purpose. It is provided "as i=
s"<BR> without express or implied wa=
rranty of any kind.<BR><BR> These no=
tices must be retained in any copies o=
f any part of this<BR> documentation=
and/or software.<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D</SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000"> Constants for _MD5Transform routine. <=
/SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S11 7</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S12 12</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S13 17</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S14 22</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S21 5</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S22 9</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S23 14</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S24 20</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S31 4</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S32 11</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S33 16</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S34 23</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S41 6</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S42 10</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S43 15</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> S44 21</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">static</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: #000000"> _MD5Transform(unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN style=3D"COLOR: =
#000000">[</SPAN><SPAN=20
style=3D"COLOR: #000000">4</SPAN><SPAN style=3D"COLOR: =
#000000">], </SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN style=3D"COLOR: =
#000000">[</SPAN><SPAN=20
style=3D"COLOR: #000000">64</SPAN><SPAN style=3D"COLOR: =
#000000">]);<BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">static</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: #000000"> _Encode(unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN style=3D"COLOR: =
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">, unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN style=3D"COLOR: =
#000000"> </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">, unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN style=3D"COLOR: =
#000000">);<BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">static</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: #000000"> _Decode(unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN style=3D"COLOR: =
#000000"> </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN style=3D"COLOR: =
#000000">, </SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN style=3D"COLOR: =
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">, unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000">);<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">static</SPAN><SPAN=20
style=3D"COLOR: #000000"> unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> PADDING[</SPAN><SPAN=20
style=3D"COLOR: #000000">64</SPAN><SPAN style=3D"COLOR: =
#000000">] </SPAN><SPAN=20
style=3D"COLOR: #000000">=3D</SPAN><SPAN=20
style=3D"COLOR: #000000"> {<BR> </SPAN><SPAN =
style=3D"COLOR: #000000">0x80</SPAN><SPAN=20
style=3D"COLOR: #000000">, </SPAN><SPAN style=3D"COLOR: =
#000000">0</SPAN><SPAN=20
style=3D"COLOR: #000000">, </SPAN><SPAN style=3D"COLOR: =
#000000">0</SPAN><SPAN=20
style=3D"COLOR: #000000">, </SPAN><SPAN style=3D"COLOR: =
#000000">0</SPAN><SPAN=20
style=3D"COLOR: #000000">, </SPAN><SPAN style=3D"COLOR: =
#000000">0</SPAN><SPAN=20
style=3D"COLOR: #000000">, </SPA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -