Superguid

March 1, 2008 at 9:48 am Leave a comment

For those of you who think, like me, that a regular GUID is for wimps and lUzer5, I have created something a lot better : the Superguid.

Not 128, but 256 bits of pure binary goodness, guaranteed to be 2^128 times as unique as a regular guid.

Some samples :

{09A9EE54-A605-4FD0-FE88-
CF44D37E4DC2-B246CA47-CD26-
4097-8F8D-6B61D521B364}

{F69D23E9-8852-4CE9-BAB0-
F19F730F2137-FC0C17EA-880A-
4B89-4EA9-37663121246B}

{F69D23E9-8852-4CE9-BAB0-
F19F730F2137-FC0C17EA-880A-
4B89-4EA9-37663121246B}

For those who are interested in creating their own superguids, you can find a Ruby script below to do just that.

require 'Win32API'@uuid_create = Win32API.new('rpcrt4', 'UuidCreate', 'P', 'L')

def raw_guid
result = ' ' * 16
@uuid_create.call(result)
result
end

def super_guid
result = raw_guid + raw_guid
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16  = result.unpack('SSSSSSSSSSSSSSSS')
sprintf('{%04X%04X-%04X-%04X-%04X-%04X%04X%04X-%04X%04X-%04X-%04X-%04X-%04X%04X%04X}', d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16 )
end

print super_guid
Advertisements

Entry filed under: Command Line.

A simple and fast permutation generator (7) The universal velcro snafu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

Categories


%d bloggers like this: