{"action":"created","issue":{"url":"https://api.github.com/repos/SammyK/php-src-csprng/issues/3","labels_url":"https://api.github.com/repos/SammyK/php-src-csprng/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/SammyK/php-src-csprng/issues/3/comments","events_url":"https://api.github.com/repos/SammyK/php-src-csprng/issues/3/events","html_url":"https://github.com/SammyK/php-src-csprng/pull/3","id":58902719,"number":3,"title":"Implement random_bytes() and random_int()","user":{"login":"sarciszewski","id":3710836,"avatar_url":"https://avatars.githubusercontent.com/u/3710836?v=3","gravatar_id":"","url":"https://api.github.com/users/sarciszewski","html_url":"https://github.com/sarciszewski","followers_url":"https://api.github.com/users/sarciszewski/followers","following_url":"https://api.github.com/users/sarciszewski/following{/other_user}","gists_url":"https://api.github.com/users/sarciszewski/gists{/gist_id}","starred_url":"https://api.github.com/users/sarciszewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarciszewski/subscriptions","organizations_url":"https://api.github.com/users/sarciszewski/orgs","repos_url":"https://api.github.com/users/sarciszewski/repos","events_url":"https://api.github.com/users/sarciszewski/events{/privacy}","received_events_url":"https://api.github.com/users/sarciszewski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-25T13:40:38Z","updated_at":"2015-02-25T14:47:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/SammyK/php-src-csprng/pulls/3","html_url":"https://github.com/SammyK/php-src-csprng/pull/3","diff_url":"https://github.com/SammyK/php-src-csprng/pull/3.diff","patch_url":"https://github.com/SammyK/php-src-csprng/pull/3.patch"},"body":"Also pulled all of the testing code out of the main csrpng.php file"},"comment":{"url":"https://api.github.com/repos/SammyK/php-src-csprng/issues/comments/75971857","html_url":"https://github.com/SammyK/php-src-csprng/pull/3#issuecomment-75971857","issue_url":"https://api.github.com/repos/SammyK/php-src-csprng/issues/3","id":75971857,"user":{"login":"sarciszewski","id":3710836,"avatar_url":"https://avatars.githubusercontent.com/u/3710836?v=3","gravatar_id":"","url":"https://api.github.com/users/sarciszewski","html_url":"https://github.com/sarciszewski","followers_url":"https://api.github.com/users/sarciszewski/followers","following_url":"https://api.github.com/users/sarciszewski/following{/other_user}","gists_url":"https://api.github.com/users/sarciszewski/gists{/gist_id}","starred_url":"https://api.github.com/users/sarciszewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarciszewski/subscriptions","organizations_url":"https://api.github.com/users/sarciszewski/orgs","repos_url":"https://api.github.com/users/sarciszewski/repos","events_url":"https://api.github.com/users/sarciszewski/events{/privacy}","received_events_url":"https://api.github.com/users/sarciszewski/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T14:47:16Z","updated_at":"2015-02-25T14:47:16Z","body":"I typed this up on the bus, forgot to summarize what it does:\r\n\r\n* `random_bytes()`\r\n  * uses `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` if it's available and on a safe PHP version\r\n  * uses `openss_random_pseudo_bytes()`\r\n  * reads from `/dev/urandom` as a fallback (PHP < 5.3.7)\r\n  * TODO: add CAPICOM support (a'la my WordPress patch)\r\n* `random_hex()` just grabs data from `random_bytes()` and converts it to hex\r\n* `random_int()` uses `random_bytes()` to create an integer\r\n"}}