473,805 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Guids, Unique Id's and Hashes

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

Nov 21 '05 #1
14 2713
"Chris Dunaway" <du******@gmail .com> schrieb:
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?


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/>

Nov 21 '05 #2
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

Nov 21 '05 #3
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.goo glegroups.com.. .
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

Nov 21 '05 #4
"Chris Dunaway" <du******@gmail .com> schrieb:
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?


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/>

Nov 21 '05 #5
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

Nov 21 '05 #6
Robin,
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 ;)

Are you sure of this and in my opinion serialized it will be more.

http://msdn.microsoft.com/library/de...classtopic.asp

Cor
Nov 21 '05 #7
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.goo glegroups.com.. .
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

Nov 21 '05 #8
"Robin Tucker" <id************ *************@r eallyidont.com> schrieb:
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 ;)


GUIDs are 16 bytes...

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

Nov 21 '05 #9
My mistake, I didn't divide 128 bits by 8 correctly :/

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uF******** ******@TK2MSFTN GP14.phx.gbl...
"Robin Tucker" <id************ *************@r eallyidont.com> schrieb:
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 ;)


GUIDs are 16 bytes...

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

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
18623
by: Mamuninfo | last post by:
Hello, Have any function in the DB2 database that can generate unique id for each string like oracle, mysql,sybase,sqlserver database. In mysql:- select md5(concat_ws("Row name")) from tablename; Here this function generate unique id for each row of the table. Regards..
4
33990
by: J.Marsch | last post by:
I notice that when I generate various guids, they appear to have a mix of upper and lowercase letters. Is the uniqueness of a guid case-sensitive? In other words, if I generate a guid, and then store it in a database that is case insensitive (or if I convert the letters to upper), is it still statistically unique?
1
10986
by: vector | last post by:
I've got an application that generates GUIDs. A lot of GUIDs. Lots of GUIDs that end up in files on disk, taking up space. I'd like to continue using the Guid.NewGuid() function as my unique tag generator, but I'd also like to compress them to base 36 strings, which should retain their uniqueness but save me disk space. I've looked at various base conversion functions, and haven't found a suitable one. Further, I don't need an AnyBase...
5
2661
by: EP | last post by:
This inquiry may either turn out to be about the suitability of the SHA-1 (160 bit digest) for file identification, the sha function in Python ... or about some error in my script. Any insight appreciated in advance. I am trying to reduce duplicate files in storage at home - I have a large number files (e.g. MP3s) which have been stored on disk multiple times under different names or on different paths. The using applications will...
15
2088
by: A. Farber | last post by:
Hello, I'm programming a web game on OpenBSD, but am also trying to keep in runnable on Linux and Cygwin. I have a list of tables at which a player/kibitzer can sit down or create a new empty one if (s)he wants. I keep tables in a doubly-linked list using the nice TAILQ_* macros: http://www.openbsd.org/cgi-bin/man.cgi?query=queue
3
3790
by: JT | last post by:
Hi, I am having trouble finding information about GUIDs and strong-names and don't really know what I need. If that's too ambiguous, please tell me where to look for info on these. Here's what I am trying to accomplish: I need to know what assembly is calling methods in a web service. I also use ILMerge.exe to merge my assemblies into a single executable. One of the dlls in the executable calls the web service. I need to enforce...
14
6861
by: howa | last post by:
For example, if two hosts arrive a server at the same time (microtime), and using the same IP via NAT, and may be even lucky enough to have the same random number How PHP make them to use different session ID? or in fact PHP session is not 100% safe enought? thanks.
17
1733
by: Matija Papec | last post by:
I would like to be able to convert any reference (function, object, or array) into unique string id and retrieve original reference afterwards using same id. The following code does this but only for functions, and for some unknown reason does not work properly for other kind of references. var func = function(){}; var ref_id = $GS(func);
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10369
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.