user358186
user358186

Reputation:

Base 256 GUID String Representation w/Character Offset 0x01F

I need to make a string representation of a 128bit GUID that represents 8bit chunks instead of 4bit; so like base 256 :/ Why? Because I need to shorten the length of the string hex representation of the GUID, it is too long. I have a max array size of 31 plus NULL terminator. Also the character value cannot be from 0x000 to 0x01F.... It's giving me a headache but I know it can be done. Any suggestions on the best and safest way how? Right now I'm just mucking around with memcpy and adding 0x01F but the numbers keep bouncing around in my head.... can't nail 'em down no! And I have to interconvert :\

Upvotes: 1

Views: 676

Answers (2)

sharptooth
sharptooth

Reputation: 170499

Having that OLESTR first convert it into a GUID with IIDFromString(), then use base64 as user Peter Tillemans suggests.

Upvotes: 0

Peter Tillemans
Peter Tillemans

Reputation: 35341

Try base64 encoding : it packs 6-bits per character and is still portable. You will need 22 chars to store 128 bits GUID in a portable way.

Upvotes: 1

Related Questions