473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2690
"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.googlegr oups.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.googlegr oups.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*************************@reallyidont.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**************@TK2MSFTNGP14.phx.gbl...
"Robin Tucker" <id*************************@reallyidont.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
Yes, what I meant to say was that, a guid being 16 bytes (ehem, excuse my
math) might look like this:
ABACACABACACBACD (128 bits = 16 bytes = 16 ASCII chars)

but stored as a string it will be bigger, like this:

00000118-0000-0000-C000-000000000046 (36 characters)


"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oi**************@TK2MSFTNGP15.phx.gbl...
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 #11
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 #12
"Robin Tucker" <id*************************@reallyidont.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 #13
My mistake, I didn't divide 128 bits by 8 correctly :/

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uF**************@TK2MSFTNGP14.phx.gbl...
"Robin Tucker" <id*************************@reallyidont.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 #14
Yes, what I meant to say was that, a guid being 16 bytes (ehem, excuse my
math) might look like this:
ABACACABACACBACD (128 bits = 16 bytes = 16 ASCII chars)

but stored as a string it will be bigger, like this:

00000118-0000-0000-C000-000000000046 (36 characters)


"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oi**************@TK2MSFTNGP15.phx.gbl...
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 #15

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

Similar topics

10
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...
4
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...
1
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...
5
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...
15
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...
3
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...
14
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...
17
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.