Anonymous
Not applicable
2015-02-11
11:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert AD's objectGUID to string
Hi!
I need to convert an Active Directory's objectGUID (which is binary data) to a string (like "9698dc61-89f0-42b9-90c8-b54aee97d4ff").
How can I do it?
I need to convert an Active Directory's objectGUID (which is binary data) to a string (like "9698dc61-89f0-42b9-90c8-b54aee97d4ff").
How can I do it?
427 Views
3 Replies
Anonymous
Not applicable
2015-02-11
01:12 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a routine and add this method to it:
public static String toHexString(byte[] bin) {
StringBuilder sb = new StringBuilder();
for (byte b : bin) {
sb.append(Integer.toHexString(b));
}
return sb.toString();
}
427 Views
Anonymous
Not applicable
2015-02-11
01:50 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
jlolling!
The solution produce output like "61ffffffdcffffff98ffffff96fffffff0ffffff89ffffffb942ffffff90ffffffc8ffffffb54affffffeeffffff97ffffffd4ffffffff" (instead of 9698dc61-89f0-42b9-90c8-b54aee97d4ff), but you have pointed me to right way, so I'll try to use existing java examples to generate required string.
If anybody have the complete solution for generation GUID in AD style, post it here, please.
The solution produce output like "61ffffffdcffffff98ffffff96fffffff0ffffff89ffffffb942ffffff90ffffffc8ffffffb54affffffeeffffff97ffffffd4ffffffff" (instead of 9698dc61-89f0-42b9-90c8-b54aee97d4ff), but you have pointed me to right way, so I'll try to use existing java examples to generate required string.
If anybody have the complete solution for generation GUID in AD style, post it here, please.
427 Views
Anonymous
Not applicable
2015-02-11
02:38 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, the values you get are 4-byte digits. My code was made for 1-byte digits.
427 Views