First of all, you're in luck, 36 ^ 50 is about 2 ^ 258.5, so you can save the information in a line with a 50 byte byte. It is interesting, however, why for this someone will have to use base-36.
You need to treat each GUID as a 128-bit number, and then combine them into a 256-bit number, which is then converted to base number 36. Converting back does the same thing in reverse.
Guid.ToByteArray
converts a GUID to a 16-byte array. Do this for both GUIDs, and you have an array of 32 bytes (which is 256 bits). Build a BigInt
from this array (there is a constructor there), and then just convert that number to base-36.
To convert a number to base 36, do something like this (I assume everything is positive)
const string digits = "0123456789abcdefghijklmnopqrstuvwxyz"; string ConvertToBase36(BigInt number) { string result = ""; while(number > 0) { char digit = string[number % 36]; result += digit; number /= 36; } }
source share