English 中文(简体)
当地独特的识别资料
原标题:Locally unique identifier

问题: 如果有的话。 NET GUID用于在数据库中安装,其结构类似:

60 bits of timestamp, 
48 bits of computer identifier,
14 bits of uniquifier, and
 6 bits are fixed, 
----
128 bits total

现在,我与一个统一投资基金有问题,因为它有128个比数,一些第一行只使用64个比数。

现在,我不想通过使用自动加固的重物价值来解决这一难题,因为我希望能够进行离线复制。

因此,我提出建立一个当地独特的识别类别的想法,这个类别基本上是一个排在64位轨道值的GUID。

我来到这里:

day  9 bit (12*31=372 d)
year 8 bit (2266-2010 = 256 y)
seconds  17 bit (24*60*60=86400 s)
hostname 12 bit (2^12=4096)
random 18 bit (2^18=262144)
------------------------
          64 bits total

现在我的问题是:时间长度大致固定在34个轨道上,使我拥有64-34=30个分位,用于接收国名+随机编号。

Now my question: 1) Would you rather increase the hostname-hash bitsize and decrease the random bitsize, or increase the random bitsize and decrease the hostname-hash bitsize.

2) Exists there a hash algorithm that reduces every string to n-Bits? n being ideally = 12 or as near as possible.

最佳回答

实际上,网络生成的GUIDs是6个固定借方和122个随机点。

你可以考虑仅仅使用64个随机轨道,由于距离较小,碰撞的可能性增加。 它将比散射更好。

问题回答

如果空间没有引起关切,那么你为什么不只使用6个范围很广的2个栏,然后用8个字将指导数分成一半,然后将指导数改为你的64个字数,并在2个栏中储存,那么,如果你确实需要提升到另一个系统的话,你就仍然有独一无二之处,你在重新加入2个栏中只需要考虑。

为什么写自己的字? 为什么不仅仅产生一个统一的随机数字? 它将出色地完成这项工作。 仅 gr头一位X位数,而X级是你们想要的大小......就说64位。

here 用于RAND(<>/code> vsNED() inkous,这实际上只是对GUIDs诉随机号发电机的起诉。 另见here。 如果你需要比<代码>System.Random更随机。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签