SuperCard 4.8 and Universally Unique Identifiers (UUIDs)

Need help with a script? This is the place to discuss how to get your code running!

SuperCard 4.8 and Universally Unique Identifiers (UUIDs)

Postby codegreen » Mon Mar 21, 2016 11:41 am

A UUID (Universally Unique Identifier) is simply a 128-bit value constructed according to one of several variants of a standard hashing algorithm that's designed to generate a unique key each time (keep in mind that in this context that doesn't mean it's TOTALLY IMPOSSIBLE for two UUIDs to be the same, just unlikely enough…).

For human-readable display UUIDs are commonly represented as a string of hexadecimal digits with inserted hyphens, like so:

Code: Select all
   18F1062E-5AAB-4460-ACDA-0E80A7C26974

SuperCard 4.8 allows you to generate and validate UUIDs using two new utility functions:

Code: Select all
   put createUUID()  -- 18F1062E-5AAB-4460-ACDA-0E80A7C26974

   put isUUID("18F1062E-5AAB-4460-ACDA-0E80A7C26974")  -- true

Since they're designed to allow distributed systems to uniquely identify information without active central coordination, UUIDs are the ultimate 'temporary file name' that you can safely use without worry about collision with identifiers generated by anything or anyone else.

Your Mac's motherboard even has a UUID, which you can retrieve via SuperCard 4.8's new machinePlatformUUID property:

Code: Select all
   put isUUID(the machinePlatformUUID)  -- true

You can use this value to bind a project or standalone to one specific Mac, or to identify which among several it's currently running on.

UUIDs also have other uses in 4.8, which we'll get to later...

-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm

Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest

cron