guid发生器如何工作 [英] how guid generator works

查看:98
本文介绍了guid发生器如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要获得64位的Guid.我知道使用COM生成GUID会给我128位.这可能是一个愚蠢的问题,因为我想MS会希望将其保密,但不会带来任何危害:有人知道它是如何工作的吗?它使用MD5吗?

我似乎有个朦胧的记忆,有人提到使用MD5哈希的前64位是一种标准做法.是真的吗?

我确实遇到了一些自定义的哈希机制,例如murmurhash的64位,但是由于许可问题,我想避免..还有其他想法吗?

我可以考虑使用RNG组成我自己的几乎唯一"的Guid,并在其上加上时间戳..但是显然,它太不确定了,无法知道错误的可能性,因此在使用它之前需要为我提供很多说服力.

谢谢,
Shishir

Hi,

I need to get a guid of 64 bits. I know that guid generation using COM will give me 128 bits. It might be a stupid question since I would like to think MS would want to keep it secret but no harm trying : Does anyone know how does it work ? Does it use MD5 ?

I seem to have a hazy memory of someone mentioning that it is a standard practice to use first 64 bits of the MD5 hash.. is that true ?

I did come-across some custom hashing mechanisms like murmurhash for 64 bits but due to licensing, I would want to avoid.. are there any other ideas ?

I can think of making up my own "almost unique" guids using RNGs and seeding it with time-stamp.. but obviously its too indeterminate to know the error probability and hence would need a lot of convincing for myself before using it.

Thanks,
Shishir

推荐答案

我没有读过,但这可能会回答您的问题:

http://www.webdav.org/specs/draft-leach-uuids-guids- 01.txt [ ^ ]
I didn''t read it, but this might answer your question:

http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt[^]


只需添加到上面的答案,我们就只能使用UUID生成器的前几个字节.算法的设计方式是,如果使用输出的一部分,则等效于使用低字节生成器.例如,SHA-512哈希算法的128位输出在密码上应与使用128位MD5算法一样强. ..
Just to add to the above answer, we can use only the first few bytes of the UUID generator.. The above link shows that MD5 is used.. and hashing algorithms are designed such that if you use a part of the output, it is equivalent to using low-byte generator.. for example, 128 bits output of the SHA-512 Hash algorithm should be cryptographically as strong as using a 128 bit MD5 algorithm..


这篇关于guid发生器如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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