📄 一个uuid生成算法的c语言实现 --- win32版本.mht
字号:
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">uuid_to_string(</SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_t</SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid);<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000">*<BR> * Get timestamp from a UUID<=
BR> *</SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">void</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_to_timestamp(</SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_t</SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid, timestamp_t</SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000"> time);<BR><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000">*<BR> * Resurn a description of ti=
mestamp NOT including fraction<BR> *</SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN style=3D"COLOR: =
#000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000"> timestamp_to_string(</SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> timestamp_t</SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000"> time);<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000">*<BR> * Compare two UUID's lexically<BR=
> * return<BR> * =
-1 u1 is lexically before&nbs=
p;u2<BR> * 0 u1 i=
s equal to u2<BR> * 1&nb=
sp; u1 is lexically after u2<BR></SPAN><SP=
AN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_compare(</SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_t </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">u1, </SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_t </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">u2);<BR><BR></SPAN><SPAN=20
style=3D"COLOR: #008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000">*<BR> * Compare two UUID's temporally<B=
R> * return<BR> *  =
; -1 u1 is temporally before&n=
bsp;u2<BR> * 0 u1 =
;is equal to u2<BR> * 1&=
nbsp; u1 is temporally after u2<BR></SPAN>=
<SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_compare_time(</SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_t </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">u1, </SPAN><SPAN=20
style=3D"COLOR: #0000ff">const</SPAN><SPAN=20
style=3D"COLOR: #000000"> uuid_t </SPAN><SPAN=20
style=3D"COLOR: #000000">*</SPAN><SPAN=20
style=3D"COLOR: #000000">u2);<BR><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#endif</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> /* UUID32_H=
_INCLUDED */</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN></DIV></DIV></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><SPAN> =20
=E5=85=B6=E4=B8=AD=EF=BC=8C=E5=A4=B4=E6=96=87=E4=BB=B6"cdatatype.h"=E5=A6=
=82=E4=B8=8B=EF=BC=9A</SPAN></DIV>
<DIV><SPAN></SPAN> </DIV>
<DIV> =20
<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"> cdatatype.h <BR> 2008-09-15 Las=
t created by cheungmine.<BR> All rig=
hts reserved by cheungmine.<BR></SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>#ifndef CDATATYPE_H__<BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> CDATATYPE_H__</SPAN><SPAN=20
style=3D"COLOR: #000000"><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=3D=3D=3D=
=3D=3D=3D=3D</SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>typedef unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">char</SPAN><SPAN=20
style=3D"COLOR: #000000"> uchar, </SPAN><SPAN=20
style=3D"COLOR: #0000ff">byte</SPAN><SPAN=20
style=3D"COLOR: =
#000000">, BYTE;<BR><BR>typedef unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">short</SPAN><SPAN=20
style=3D"COLOR: #000000"> uint16, word_t, </SPAN><SPAN=20
style=3D"COLOR: #0000ff">ushort</SPAN><SPAN=20
style=3D"COLOR: =
#000000">;<BR><BR>typedef unsigned </SPAN><SPAN=20
style=3D"COLOR: #0000ff">int</SPAN><SPAN style=3D"COLOR: =
#000000"> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">uint</SPAN><SPAN=20
style=3D"COLOR: =
#000000">, uint32, dword_t, size_t;<BR><BR>typedef un=
signed </SPAN><SPAN=20
style=3D"COLOR: #0000ff">long</SPAN><SPAN=20
style=3D"COLOR: #000000"> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">ulong</SPAN><SPAN=20
style=3D"COLOR: =
#000000">;<BR><BR>typedef __int64 int64;<BR>typedef unsign=
ed __int64 uint64, qword_t;<BR><BR><BR>#ifndef BOOL<B=
R> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> BOOL int</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> TRUE 1</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> FALSE 0</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#endif</SPAN><SPAN=20
style=3D"COLOR: =
#000000"><BR><BR>#ifndef RESULT<BR> </SPAN><S=
PAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> RESULT long</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SUCCESS 0</=
SPAN><SPAN=20
style=3D"COLOR: #000000"><BR> </SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> ERROR -1</S=
PAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#endif</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_BYTE 1</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_SHORT 2</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_INT 4</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_FLT 4</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_DBL 8</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_WORD 2</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_DWORD 4</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_QWORD 8</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_LINT 8</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_INT64 8</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> SIZE_UUID 16</SPAN><SPAN=20
style=3D"COLOR: #000000"><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=3D=3D=3D=
=3D=3D=3D=3D</SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN style=3D"COLOR: =
#000000"><BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#endif</SPAN><SPAN=20
style=3D"COLOR: =
#000000"> /*CDATATYPE_H__*/</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN></DIV></DIV></DIV>
<P> =20
MD5=E7=AE=97=E6=B3=95=E7=94=9F=E6=88=90=E7=9A=84=E6=96=87=E4=BB=B6=E6=9C=89=
=EF=BC=9Amd5.h=E5=92=8Cmd5.c=EF=BC=8C=E5=88=86=E5=88=AB=E7=BD=97=E5=88=97=
=E5=A6=82=E4=B8=8B=EF=BC=9A</P>
<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: =
#000000">#ifndef _MD5_H__<BR></SPAN><SPAN=20
style=3D"COLOR: #0000ff">#define</SPAN><SPAN=20
style=3D"COLOR: #000000"> _MD5_H__</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR></SPAN><SPAN style=3D"COLOR: =
#008000">/*</SPAN><SPAN=20
style=3D"COLOR: =
#008000"> MD5.H - header file for MD5C.C&nb=
sp;</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"> Copyright (C) 1991-2, RSA Data Se=
curity, Inc. Created 1991. All<BR> r=
ights reserved.<BR><BR> License to copy&n=
bsp;and use this software is granted provid=
ed that it<BR> is identified as =
;the "RSA Data Security, Inc. MD5 Message-D=
igest<BR> Algorithm" in all material =
;mentioning or referencing this software<BR> &nb=
sp; or this function.<BR><BR> License&nbs=
p;is also granted to make and use deri=
vative works provided<BR> that such =
works are identified as "derived from the&n=
bsp;RSA Data<BR> Security, Inc. MD5 =
Message-Digest Algorithm" in all material<BR> &n=
bsp; mentioning or referencing the derived =
work.<BR><BR> RSA Data Security, Inc.&nbs=
p;makes no representations concerning either<BR> =
; the merchantability of this software&nbs=
p;or the suitability of this<BR> sof=
tware for any particular purpose. It is&nbs=
p;provided "as is"<BR> without express&nb=
sp;or implied warranty of any kind.<BR><BR> =
; These notices must be retained in&n=
bsp;any copies of any part of this<BR> =
; documentation and/or software.<BR><BR> =
2007-09-15 Last modified by cheungmine.<BR>&nbs=
p;</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"> MD5 context. </SPAN><SPAN=20
style=3D"COLOR: #008000">*/</SPAN><SPAN=20
style=3D"COLOR: #000000"><BR>typedef </SPAN><SPAN=20
style=3D"COLOR: #0000ff">struct</SPAN><SPAN=20
style=3D"COLOR: =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -