Convert binary to UUID from LDAP

Steven Schveighoffer schveiguy at gmail.com
Tue Mar 28 00:51:43 UTC 2023


On 3/27/23 1:56 PM, Alexander Zhirov wrote:
> I get `objectGUID` data from LDAP as binary data. I need to convert 
> `ubyte[]` data into a readable `UUID`. As far as I understand, it is 
> possible to do this via `toHexString()`, but I have reached a dead end. 
> Is there a way to make it more elegant, like [this 
> technique](https://dlang.org/phobos/std_uuid.html#.UUID)?
> 
> ```
> ubyte[] => [159, 199, 22, 163, 13, 74, 145, 73, 158, 112, 7, 192, 12, 
> 193, 7, 194]
> hex     => 9FC716A30D4A91499E7007C00CC107C2
> ```

auto uuid = UUID(*cast(ubyte[16]*)youruuiddata.ptr);

-Steve


More information about the Digitalmars-d-learn mailing list