On Monday, 27 March 2023 at 17:56:22 UTC, 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
```

https://run.dlang.io/is/JP01aZ

    ```
    void main(){
        import std.stdio: writeln;
        import std.format: format;
ubyte[] a = [159, 199, 22, 163, 13, 74, 145, 73, 158, 112, 7, 192, 12, 193, 7, 194];
        string b = format("%(%.2X%)",a);
        writeln(b);
    }
    ```

Reply via email to