如何从C#中的GUID V4 /梳子中提取时间戳 [英] How to extract time stamp from GUID V4/comb in C#

查看:254
本文介绍了如何从C#中的GUID V4 /梳子中提取时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

few samples of GUID
3eee0e14-75cf-41af-afa3-f3a89e293c4c
9f463ddb-5a5e-4e90-b947-e26e0becb78a 





我的尝试:



i不能找到代码开始解码只有一个链接

[ ^ ]

推荐答案

它并不那么简单。



并非每个GUID(或UUID)都有一个时间戳组件。我知道有5个版本的UUID,其中只有2个使用它们生成的时间。



由Windows生成的GUID版本为4(随机生成)在过去的20年里。其中没有时间组件。



您发布的两个示例是版本4 GUID。第3组中的第一个数字是4,表示这是版本4 GUID。您还会发现版本4 GUID的第4组中的第一个数字始终为8,9,A或B.这是因为该数字中的两个位保留用于版本信息。 />


在版本4 GUID中,为版本数据保留6位,其余是随机生成的。
It's not that simple.

Not every GUID (or UUID) has a timestamp component in it. There are 5 versions of UUID's that I know of, only 2 of which use the time they are generated.

GUID's generated by Windows have been version 4 (Randomly Generated) for the last 20-ish years. There is no time component in them.

The two samples you posted are version 4 GUIDs. The first digit in the 3rd group is a 4, signaling this is a version 4 GUID. You'll also find that the first digit in the 4th group of a version 4 GUID is always going to be 8, 9, A, or B. This is because two of the bits in that digit are reserved for version information.

In a version 4 GUID, 6 bits are reserved for version data, the rest are randomly generated.


您不能: 什么是GUID [ ^ ] - 版本4 GUID是随机的,除了四位版本和两位变量字段外,它们不包含时间戳。
You can't: What is a GUID[^] - Version 4 GUIDs are random with the exception of the four bit Version, and two bit variant fields, they do not contain a timestamp.


这篇关于如何从C#中的GUID V4 /梳子中提取时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆