I am working on a system that is 50% iOS and 50% Microsoft.NET C#. The primary ids used within the system are Guids/NSUUIDs, and these are converted into Base64 strings from time-to-time. I have a discrepancy in how .NET and iOS perform the base64 conversion.

Here is my objective-c code to convert an NSUUID (in string format) to a Base64 string:

```
+(NSString*)getBase64IdFromGuidStringWithString:(NSString*)stringInGuidFormat
{
    NSLog(@"stringInGuidFormat is %@",stringInGuidFormat);

    NSUUID* nsuuid = [[NSUUID alloc] initWithUUIDString:stringInGuidFormat];
    uuid_t uuid;
    [nsuuid getUUIDBytes:uuid];
    NSData* data = [NSData dataWithBytes:uuid length:16];
    NSString* base64 = [data base64EncodedString];

    NSLog(@"base64 is %@",base64);
    return base64;

}

```

where [data base64EncodedString] is courtesy of [Matt Gallagher](http://www.cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html) 

and here is a similar method in .NET C# to do the same thing:

```
private string convertGuidStringToBase64(string elementAsString)
{
    Guid isAsGuid = new Guid(elementAsString);
    string base64 = Convert.ToBase64String(isAsGuid.ToByteArray());
    return base64;
}

```

Given a starting string value of CBB2B719-D129-4051-B694-4204A6F6BE93 I have the following results:
iOS thinks the base64 value is y7K3GdEpQFG2lEIEpva+kw==
C# thinks the base64 value is GbeyyynRUUC2lEIEpva+kw==

Obviously I have got something wrong! Can anyone point out my error, and point me in the right direction to solve it!

Many thanks.