Guids,Unique Id和Hashes [英] Guids, Unique Id's and Hashes

查看:111
本文介绍了Guids,Unique Id和Hashes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Guid'作为数据应用程序中的唯一标识符。但是在最近的一个项目中,Guid'字符串的长度证明太长了。有没有一种方法可以生成一个比Guid长度少的b / b
的唯一字符串?


如果我要使用Guid字符串的哈希值,两个不同的Guid会有相同的哈希值的可能性是多少?


任何人都可以提供任何其他建议吗?


谢谢

I have used Guid''s as a unique identifier in data applications. But in
a recent project, the length of the Guid''s string is proving to be too
long. Is there a method for generating a unique string that is less
than the length of a Guid?

If I were to take the hash of a Guid string, what is the likelyhood
that two different Guids would have the same hash?

Can anyone offer any other suggestions?

Thanks

推荐答案

" Chris Dunaway" <杜****** @ gmail.com> schrieb:
"Chris Dunaway" <du******@gmail.com> schrieb:
我在数据应用程序中使用了Guid'作为唯一标识符。但是在最近的一个项目中,Guid'字符串的长度证明太长了。有没有一种方法可以生成一个比Guid长度更小的独特字符串?
I have used Guid''s as a unique identifier in data applications. But in
a recent project, the length of the Guid''s string is proving to be too
long. Is there a method for generating a unique string that is less
than the length of a Guid?




我很好奇最大值。您描述的

场景中标识符的字符数是...


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>



I am curious what the max. number of characters for the identifier in the
scenario you describe is...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


目前,该字段的长度为30个字符,但其中的数据

采用以下格式(不要问我为什么,我继承了这个

代码):


< custnum> - < uniqueid> - < city,state> ;


整个字符串必须是唯一的。 custnum,city和state必须

也是字符串的一部分。


我可以增加字段的大小,但我必须在许多其他表中增加

这个相同字段的大小。除非我必须这样做,否则我犹豫不决。




我试图确定缩短字符串的方法。

谢谢

At the moment, the length of the field is 30 characters, but the data
in it is in the following format (don''t ask me why, I inherited this
code):

<custnum>-<uniqueid>-<city,state>

The entire string must be unique. The custnum, city, and state must
also be part of the string.

I can increase the size of the field, but I would then have to increase
the size of this same field in many other tables. I am hesitant to do
this unless I have to.

I was trying to determine a method to shorten the string.

Thanks


它只有8个字节 - 所以我猜你是不是在存储GUID号码,

但是实际解码后的字符串,你会占用更多的空间;)


" Chris Dunaway" <杜****** @ gmail.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...
It''s 8 bytes only - so I''m guessing if you aren''t storing the GUID number,
but instead the actual decoded string, you will use up a tad more space ;)

"Chris Dunaway" <du******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
我使用Guid'作为数据应用程序中的唯一标识符。但是在最近的一个项目中,Guid'字符串的长度证明太长了。有没有一种方法可以生成一个比Guid长度更小的唯一字符串?

如果我要使用Guid字符串的哈希值,那么可能性是什么? >两个不同的Guids会有相同的哈希值吗?

任何人都可以提供任何其他建议吗?

谢谢
I have used Guid''s as a unique identifier in data applications. But in
a recent project, the length of the Guid''s string is proving to be too
long. Is there a method for generating a unique string that is less
than the length of a Guid?

If I were to take the hash of a Guid string, what is the likelyhood
that two different Guids would have the same hash?

Can anyone offer any other suggestions?

Thanks


这篇关于Guids,Unique Id和Hashes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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