473,804 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To create a 12 digit guid?

Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.

Jan 2 '07 #1
9 6953
Hello twang090,
>Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.
What do you mean by a 12 digit guid? A guid (see here
http://en.wikipedia.org/wiki/Guid or also here
http://en.wikipedia.org/wiki/UUID) is a 16 byte number that is typically
represented by a sequence of 32 characters, representing the 16 bytes in
hexadecimal notation. Some dashes are thrown in for good measure...

So what is it that you want to create? A 12 character random string?
Oliver Sturm
--
http://www.sturmnet.org/blog
Jan 2 '07 #2
Thanks for reply, I really appreciate it.
You are right, what I want is to create a random string that is 12
digit length, it has to be unique and I have no idea on how to do this.
Any idea? Many thanks.
Oliver Sturm wrote:
Hello twang090,
Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.

What do you mean by a 12 digit guid? A guid (see here
http://en.wikipedia.org/wiki/Guid or also here
http://en.wikipedia.org/wiki/UUID) is a 16 byte number that is typically
represented by a sequence of 32 characters, representing the 16 bytes in
hexadecimal notation. Some dashes are thrown in for good measure...

So what is it that you want to create? A 12 character random string?
Oliver Sturm
--
http://www.sturmnet.org/blog
Jan 2 '07 #3
Take a look at the system.random class. There is a method there that will
fill a byte array with random bytes. As for uniqueness, you'll need to test
for that yourself.

Mike Ober.

<tw******@gmail .comwrote in message
news:11******** **************@ n51g2000cwc.goo glegroups.com.. .
Thanks for reply, I really appreciate it.
You are right, what I want is to create a random string that is 12
digit length, it has to be unique and I have no idea on how to do this.
Any idea? Many thanks.
Oliver Sturm wrote:
>Hello twang090,
>Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.

What do you mean by a 12 digit guid? A guid (see here
http://en.wikipedia.org/wiki/Guid or also here
http://en.wikipedia.org/wiki/UUID) is a 16 byte number that is typically
represented by a sequence of 32 characters, representing the 16 bytes in
hexadecimal notation. Some dashes are thrown in for good measure...

So what is it that you want to create? A 12 character random string?
Oliver Sturm
--
http://www.sturmnet.org/blog

Jan 3 '07 #4
JR
Try System.Security .Cryptography.R NGCryptoService Provider class

JR

"Michael D. Ober" <obermd.@.alum. mit.edu.no.spam wrote in message
news:hP******** *********@newsr ead1.news.pas.e arthlink.net...
Take a look at the system.random class. There is a method there that will
fill a byte array with random bytes. As for uniqueness, you'll need to
test for that yourself.

Mike Ober.

<tw******@gmail .comwrote in message
news:11******** **************@ n51g2000cwc.goo glegroups.com.. .
>Thanks for reply, I really appreciate it.
You are right, what I want is to create a random string that is 12
digit length, it has to be unique and I have no idea on how to do this.
Any idea? Many thanks.
Oliver Sturm wrote:
>>Hello twang090,

Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.

What do you mean by a 12 digit guid? A guid (see here
http://en.wikipedia.org/wiki/Guid or also here
http://en.wikipedia.org/wiki/UUID) is a 16 byte number that is typically
represented by a sequence of 32 characters, representing the 16 bytes in
hexadecimal notation. Some dashes are thrown in for good measure...

So what is it that you want to create? A 12 character random string?
Oliver Sturm
--
http://www.sturmnet.org/blog


Jan 3 '07 #5
<tw******@gmail .comwrote in message
news:11******** **************@ i12g2000cwa.goo glegroups.com.. .
Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.
Guid g = System.Guid.New Guid();

string s= System.Guid.New Guid().ToString ();

Is that what you're looking for? If you need to manually create a GUID I
have that code around somewhere. There's an algorithm you must follow, and
it's much easier to use the built-in guid class.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise , MVP C#
http://www.coversant.net/blogs/cmullins
Jan 3 '07 #6
What about using the same format as a standard Guid.... Create a 12 Byte
array, and just increment the values in them (Assuming you will have a single
central place where you create these "Guids" and then converting the result
to Hex since each byte would have a numeric value of something between 0 and
255.

Another option would be to take the machine name and the date and time down
to the millisecond and combining that into a 12 byte array before doing the
hex conversion. (Just make sure that you application can then not create more
than one "Guid" per millisecond. Combining that with a random number may sort
you out, but you will still not be able to guarantee uniqueness, but you’ll
probably be close enough. All depends how deep you want to go.

Someone mentioned something about looking at the security namespace and (I'm
guessing) look at some hashing... but then, what are you going to hash.

Anyway, hope my ramblings help at least a little bit.

David

"tw******@gmail .com" wrote:
Trying to create a 12 digit "guid", but have no idea on how to, anyone
please have any thought? Thanks in advance.

Jan 4 '07 #7
Skanda <Sk****@discuss ions.microsoft. comwrote:
Use the method System.Guid.New Guid()
In what way does that create a 12-digit "guid"? GUIDs are 128 bits...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 10 '07 #8
>>Use the method System.Guid.New Guid()

In what way does that create a 12-digit "guid"? GUIDs are 128 bits...
Am I the only one who can see the part of the thread where this has
already been discussed, more than a week ago?

:-)
Oliver Sturm
--
http://www.sturmnet.org/blog
Jan 10 '07 #9
Oliver Sturm <ol****@sturmne t.orgwrote:
>
>Use the method System.Guid.New Guid()
In what way does that create a 12-digit "guid"? GUIDs are 128 bits...

Am I the only one who can see the part of the thread where this has
already been discussed, more than a week ago?
Nope - I was just wondering what Skanda thought benefit he/she was
providing...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 10 '07 #10

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

Similar topics

1
3288
by: j erickson | last post by:
with the following xsl and xml file, the display of the gif file with the <image/url> tag works. However, the gif file in the <description> tag using the name attribute "src" won't make the correct link to the gif file. why? <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
15
12830
by: Brian Rogers | last post by:
Hello everyone, I apologize for the cross and re-post, but I am still searching for an answer. Why can C++ can create this object, but C# can't? I am trying to create an instance of the default FTP asynchronous pluggable protocol adaptor, so I can analyse the traffic between urlmon.dll (IE) and the FTP server. The language I am attempting to use is C#.
9
11565
by: Bill | last post by:
I need to create a temporary file on the file system. I have over 5000 users What's the best method to ensure uniqueness Thank Bill
7
22039
by: ESPNSTI | last post by:
Hi, I'd like to create a Guid constant and the following doesn't work (Cannot implicitly convert type 'string' to 'System.Guid') : public const Guid MyGuid = "{ccae2079-2ebc-4200-879d-866fc82e6afa}"; Ideas? Thanks,
1
1768
by: Grey | last post by:
how to create a GUID from ASP.NET??? Is it possible to use this ID as primary key in createing DB record?? Million Thanks..
24
2848
by: M O J O | last post by:
Hi, Instead of doing this.... Public Class Form1 Public Shared Sub CreateAndShow() Dim f As New Form1 f.Show() End Sub
7
1999
by: =?Utf-8?B?SlA=?= | last post by:
I need to design a WS that will after authenicating the user, create a cookie on the users PC that made the request. All the code I keep finding is how to get a WS to read a cookie, I need it to create one. The below code doesnt add the cookie to my cache. However if I place this in an non asmx page its fine Any help you offer is apperiated public string CreateToken(string User, string App, string County) {
0
2058
by: yrogirg | last post by:
Actually, I need utf-8 to utf-8 encoding which would change the text to another keyboard layout (e.g. from english to russian ghbdtn -> ÐÒÉ×ÅÔ) and would not affect other symbols. I`m totally new to python and to more or less advanced programming. I couldn`t find the answer to the question anywhere. I`ve tried create simple utf to utf codec for some symbols but it doesn`t work. Here it is.
5
3237
by: Andy B | last post by:
I am making a web application that would randomly create an activation code and put it in a database. The web application would then send it in an email to the user with a link to go to and enter the activation code. How would I do this? and what sql server data type would I use? I want the activation code to be no longer than 12 characters, have a mix of numbers and letters and have no special symbols.
0
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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
10343
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...
0
9169
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
7633
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
6862
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();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
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.