title: How to convert Active Directory objectGUID to UUID in Coldfusion
body: <p>I have a CFLDAP query returning the objectGUID. How can I convert this to a valid UUID string in a 8-4-4-4-12 pattern in ColdFusion?</p>
  
  <p>I have specified <code>returnAsBinary="ObjectGUID"</code>, but <code>toString(getLDAP.ObjectGUID)</code> does not return the desired result.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I tried binaryEncode():</p>
  
  <pre><code>&lt;cfset guid = binaryencode(getLDAP.objectguid,"HEX")&gt; 
  </code></pre>
  
  <p>Which returns: </p>
  
  <pre><code>18E0CE3388B79C4EA4D73894AE8CD8F6
  </code></pre>
  
  <p>But I'm expecting this (was extracted and supplied by another process that I cant see their conversion steps).</p>
  
  <pre><code>3cee018-b788-4e9c-a4d7-3894ae8cd8f6 
  </code></pre>
  
  <p>Hummm... Although they don't match, the last half is the same. <code>a4d7-3894ae8cd8f6</code>. </p>