I'm writing a C# application, where objects are to be identified by their Guid. According to the customer, there should be two types:
- Standard GUID (128-bit, 36 characters)
- IFC64 GUID (132-bit, 22 characters)
I believe that the System.Guid corresponds with the first one: System.Guid consists of one int (32-bit), two shorts (each 16-bit) and eight bytes (each 8 bits), which comes together to 32 + 2*16 + 8*8 = 128 bits.
But as far as the so-called IFC64 GUID, I don't find anything.
Does anybody know in which C# library this is defined?
Thanks in advance
The IFC GUIDs are 128 bit long (not 132 bit!), same as other UUIDs. When represented in text, IFC GUIDs are encoded using radix 64 and a 64-character alphabet (see below). This is used similar to the standard hexadecimal representation, but omits the dashes and uses a larger base, such that it is more compact than hexadecimal representation.
Note that contrary to the Base64 encoding method for arbitrary binary data to text aligned left and with right-side padding, the IFC radix 64 encoding is producing a base 64 number aligned right with left-side padding. Thus, since every digit is 6 bits and 128 has a reminder of 2 when divided by 6, the first (most significant) digit is always 0, 1, 2 or 3.
Here is some C# code to illustrate: