use a real UUID for the stage ID

This commit is contained in:
Glenn Maynard
2009-08-09 23:45:18 +00:00
parent 5709eef94d
commit 4df5f8c890
5 changed files with 23 additions and 2 deletions
+18
View File
@@ -396,6 +396,24 @@ RString CryptManager::GetPublicKeyFileName()
return PUBLIC_KEY_PATH;
}
/* Generate a version 4 random UUID. */
RString CryptManager::GenerateRandomUUID()
{
uint32_t buf[4];
CryptManager::GetRandomBytes( buf, sizeof(buf) );
buf[1] &= 0xFFFF0FFF;
buf[1] |= 0x00004000;
buf[2] &= 0x0FFFFFFF;
buf[2] |= 0xA0000000;
return ssprintf("%08x-%04x-%04x-%04x-%04x%08x\n",
buf[0],
buf[1] >> 16, buf[1] & 0xFFFF,
buf[2] >> 16, buf[2] & 0xFFFF,
buf[3]);
}
/*
* (c) 2004-2007 Chris Danford, Glenn Maynard
* All rights reserved.