Skip to content

Instantly share code, notes, and snippets.

@TechZi
Created June 24, 2011 06:33
Show Gist options
  • Save TechZi/1044331 to your computer and use it in GitHub Desktop.
Save TechZi/1044331 to your computer and use it in GitHub Desktop.
Generate a unique key
<?php
$consumer_key = $this->generateKey(true);
$consumer_secret= $this->generateKey();
public function generateKey ( $unique = false )
{
$key = md5(uniqid(rand(), true));
if ($unique)
{
list($usec,$sec) = explode(' ',microtime());
$key .= dechex($usec).dechex($sec);
}
return $key;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment