Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2015 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/07e2e4833a9a19da9edc to your computer and use it in GitHub Desktop.
Save anonymous/07e2e4833a9a19da9edc to your computer and use it in GitHub Desktop.
static function generateId()
{
$id = str_replace('-', '', Q_Utils::uuid());
$secret = $secret = Q_Config::get('Q', 'external', 'secret', null);
if (isset($secret)) {
$id = $id . md5($id . $secret);
}
$id = base64_encode(pack('H*', $id));
return str_replace(array('z', '+', '/', '='), array('zz', 'za', 'zb', 'zc'), $id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment