Skip to content

Instantly share code, notes, and snippets.

@keesey
Last active December 18, 2015 15:59
Show Gist options
  • Save keesey/5808335 to your computer and use it in GitHub Desktop.
Save keesey/5808335 to your computer and use it in GitHub Desktop.
combine UIDs
function combineUIDs(o)
{
function cu(a, b)
{
function cc(a, b)
{
if (a === '-') return '-';
return Number(parseInt(a, 16) ^ parseInt(b, 16)).toString(16);
}
var i = 0,
n = a.length,
c = '';
for ( ; i < n; ++i)
{
c += combineChars(a.charAt(i), b.charAt(i));
}
return c;
}
var c = null;
for (var uid in o)
{
c = (c === null) ? uid : cu(c, uid);
}
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment