wxUUID

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Post Reply
kingkamg
I live to help wx-kind
I live to help wx-kind
Posts: 187
Joined: Tue Apr 08, 2008 1:45 pm

wxUUID

Post by kingkamg » Fri Jun 27, 2008 3:28 am

:roll: I hope everyone like it :P
Attachments
wxUUID.zip
(17.23 KiB) Downloaded 218 times

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Fri Jun 27, 2008 6:15 am

Hi,

It looks allright, but have you tested it for uniqueness with successive generation of numbers? It would (in my opinion) be easier to wrap libuuid under linux, and in windows there is some CoCreateGUID function. The problem with custom random generators and sharing a lot of UUID's or between two machines is that they are not so random after all if you create a lot in a short period of time (because your time component in the UUID will not differ much). Mostly the above libs I mentioned use your mac address as base for randomization which already gives a more random base. And, without critisizing your code why reinvent the wheel if there are already well proven libs? I would like to see a wrapper class around those two libraries to make it more wxWidgets like.

The code looks well written though ;-)
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Fri Jun 27, 2008 7:53 am

Jorg wrote:Mostly the above libs I mentioned use your mac address as base for randomization which already gives a more random base.
There is also UuidCreate() on Windows.
BTW: If I'm not mistaken, the MAC address is not used for randomization, but, at least in older versions of UuidCreate(), used as a part of the UUID. In general not a bad thing to do, as a MAC address is unique in the first place :)
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Fri Jun 27, 2008 8:19 am

Yes you are right, that is what I meant. Sharing UUID's between PC's becomes much safer this way. Not using the MAC address might be risking double entries, it is however hard to test, as the number of UUID's you can generate exceeds the available memory

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

Post Reply