Created
June 18, 2010 07:26
-
-
Save icyleaf/443359 to your computer and use it in GitHub Desktop.
consumer_key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function new_consumer_key() | |
| { | |
| // in case /dev/urandom is reusing entropy from its pool, let's add a bit more entropy | |
| $entropy = uniqid(mt_rand(), true); | |
| $hash = sha1($entropy); // sha1 gives us a 40-byte hash | |
| // The first 30 bytes should be plenty for the consumer_key | |
| // We use the last 10 for the shared secret | |
| return array( | |
| 'key' => substr($hash, 0, 30), | |
| 'secret'=> substr($hash, 30, 10)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment