{"action":"created","comment":{"url":"https://api.github.com/repos/zendframework/zf2/pulls/comments/23153508","id":23153508,"diff_hunk":"@@ -0,0 +1,103 @@\n+<?php\n+/**\n+ * Zend Framework (http://framework.zend.com/)\n+ *\n+ * @link      http://github.com/zendframework/zf2 for the canonical source repository\n+ * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)\n+ * @license   http://framework.zend.com/license/new-bsd New BSD License\n+ */\n+\n+namespace Zend\\Crypt\\Password\\Algorithm;\n+\n+use Zend\\Crypt\\Password\\Bcrypt as BcryptHasher;\n+use Zend\\Crypt\\Password\\HandlerInterface;\n+\n+/**\n+ * Password hashing handler backed by Bcrypt.\n+ */\n+class Bcrypt implements HandlerInterface\n+{\n+    /**\n+     * @var BcryptHasher\n+     */\n+    protected $backend;\n+\n+    /**\n+     * supports(): defined by HandlerInterface.\n+     *\n+     * @see    HandlerInterface::supports()\n+     * @param  string $hash\n+     * @return boolean\n+     */\n+    public function supports($hash)\n+    {\n+        return (bool) preg_match('(^\\$2[axy]?\\$\\d{2}\\$[./a-zA-Z0-9]{53}$)', $hash);\n+    }\n+\n+    /**\n+     * hash(): defined by HandlerInterface.\n+     *\n+     * @see    HandlerInterface::hash()\n+     * @param  string $password\n+     * @return string\n+     */\n+    public function hash($password)\n+    {\n+        return $this->getBackend()->create($password);\n+    }\n+\n+    /**\n+     * compare(): defined by HandlerInterface.\n+     *\n+     * @see    HandlerInterface::compare()\n+     * @param  string $password\n+     * @param  string $hash\n+     * @return boolean\n+     */\n+    public function compare($password, $hash)\n+    {\n+        return $this->getBackend()->verify($password, $hash);\n+    }\n+\n+    /**\n+     * shouldRehash(): defined by HandlerInterface.\n+     *\n+     * @see    HandlerInterface::shouldRehash()\n+     * @param  string $hash\n+     * @return boolean\n+     */\n+    public function shouldRehash($hash)\n+    {\n+        $cost   = $this->getBackend()->getCost();\n+        $values = explode('$', $hash);\n+\n+        if (count($values) < 3) {\n+            // Something is broken, this hash clearly needs to be re-hashed.\n+            return true;\n+        }\n+\n+        return ($values[2] !== $cost);\n+    }\n+\n+    /**\n+     * @return BcryptHasher\n+     */\n+    public function getBackend()\n+    {\n+        if ($this->backend === null) {\n+            $this->backend = new BcryptHasher();\n+        }\n+\n+        return $this->backend;\n+    }\n+\n+    /**\n+     * @param  BcryptHasher $backend\n+     * @return Bcrypt\n+     */\n+    public function setBackend(BcryptHasher $backend)","path":"library/Zend/Crypt/Password/Algorithm/Bcrypt.php","position":98,"original_position":98,"commit_id":"1a2f4536d8197a39776d0d9fc922b8c79889a76b","original_commit_id":"1a2f4536d8197a39776d0d9fc922b8c79889a76b","user":{"login":"ojhaujjwal","id":4995501,"avatar_url":"https://avatars.githubusercontent.com/u/4995501?v=3","gravatar_id":"","url":"https://api.github.com/users/ojhaujjwal","html_url":"https://github.com/ojhaujjwal","followers_url":"https://api.github.com/users/ojhaujjwal/followers","following_url":"https://api.github.com/users/ojhaujjwal/following{/other_user}","gists_url":"https://api.github.com/users/ojhaujjwal/gists{/gist_id}","starred_url":"https://api.github.com/users/ojhaujjwal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojhaujjwal/subscriptions","organizations_url":"https://api.github.com/users/ojhaujjwal/orgs","repos_url":"https://api.github.com/users/ojhaujjwal/repos","events_url":"https://api.github.com/users/ojhaujjwal/events{/privacy}","received_events_url":"https://api.github.com/users/ojhaujjwal/received_events","type":"User","site_admin":false},"body":"IMO Setter is not needed. Constructor will do!","created_at":"2015-01-19T11:04:28Z","updated_at":"2015-01-19T11:04:28Z","html_url":"https://github.com/zendframework/zf2/pull/6925#discussion_r23153508","pull_request_url":"https://api.github.com/repos/zendframework/zf2/pulls/6925","_links":{"self":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/comments/23153508"},"html":{"href":"https://github.com/zendframework/zf2/pull/6925#discussion_r23153508"},"pull_request":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/6925"}}},"pull_request":{"url":"https://api.github.com/repos/zendframework/zf2/pulls/6925","id":25013526,"html_url":"https://github.com/zendframework/zf2/pull/6925","diff_url":"https://github.com/zendframework/zf2/pull/6925.diff","patch_url":"https://github.com/zendframework/zf2/pull/6925.patch","issue_url":"https://api.github.com/repos/zendframework/zf2/issues/6925","number":6925,"state":"open","locked":false,"title":"Introducing a password handler authored by @DASPRiD ","user":{"login":"macnibblet","id":1127626,"avatar_url":"https://avatars.githubusercontent.com/u/1127626?v=3","gravatar_id":"","url":"https://api.github.com/users/macnibblet","html_url":"https://github.com/macnibblet","followers_url":"https://api.github.com/users/macnibblet/followers","following_url":"https://api.github.com/users/macnibblet/following{/other_user}","gists_url":"https://api.github.com/users/macnibblet/gists{/gist_id}","starred_url":"https://api.github.com/users/macnibblet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macnibblet/subscriptions","organizations_url":"https://api.github.com/users/macnibblet/orgs","repos_url":"https://api.github.com/users/macnibblet/repos","events_url":"https://api.github.com/users/macnibblet/events{/privacy}","received_events_url":"https://api.github.com/users/macnibblet/received_events","type":"User","site_admin":false},"body":"Whats left be done\r\n\r\n- [ ] What key to use for the `Zend\\Crypt\\Password\\HandlerManager` \r\n- [ ] Integrate the HandlerManager into the mvc service listener factory\r\n- [ ] Documentation","created_at":"2014-11-25T15:01:28Z","updated_at":"2015-01-19T11:04:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b89a2cef94f4ad83759257c743a7d90f897c42e0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zendframework/zf2/pulls/6925/commits","review_comments_url":"https://api.github.com/repos/zendframework/zf2/pulls/6925/comments","review_comment_url":"https://api.github.com/repos/zendframework/zf2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/zendframework/zf2/issues/6925/comments","statuses_url":"https://api.github.com/repos/zendframework/zf2/statuses/1a2f4536d8197a39776d0d9fc922b8c79889a76b","head":{"label":"macnibblet:feature/crypt-password","ref":"feature/crypt-password","sha":"1a2f4536d8197a39776d0d9fc922b8c79889a76b","user":{"login":"macnibblet","id":1127626,"avatar_url":"https://avatars.githubusercontent.com/u/1127626?v=3","gravatar_id":"","url":"https://api.github.com/users/macnibblet","html_url":"https://github.com/macnibblet","followers_url":"https://api.github.com/users/macnibblet/followers","following_url":"https://api.github.com/users/macnibblet/following{/other_user}","gists_url":"https://api.github.com/users/macnibblet/gists{/gist_id}","starred_url":"https://api.github.com/users/macnibblet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macnibblet/subscriptions","organizations_url":"https://api.github.com/users/macnibblet/orgs","repos_url":"https://api.github.com/users/macnibblet/repos","events_url":"https://api.github.com/users/macnibblet/events{/privacy}","received_events_url":"https://api.github.com/users/macnibblet/received_events","type":"User","site_admin":false},"repo":{"id":26019922,"name":"zf2","full_name":"macnibblet/zf2","owner":{"login":"macnibblet","id":1127626,"avatar_url":"https://avatars.githubusercontent.com/u/1127626?v=3","gravatar_id":"","url":"https://api.github.com/users/macnibblet","html_url":"https://github.com/macnibblet","followers_url":"https://api.github.com/users/macnibblet/followers","following_url":"https://api.github.com/users/macnibblet/following{/other_user}","gists_url":"https://api.github.com/users/macnibblet/gists{/gist_id}","starred_url":"https://api.github.com/users/macnibblet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macnibblet/subscriptions","organizations_url":"https://api.github.com/users/macnibblet/orgs","repos_url":"https://api.github.com/users/macnibblet/repos","events_url":"https://api.github.com/users/macnibblet/events{/privacy}","received_events_url":"https://api.github.com/users/macnibblet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/macnibblet/zf2","description":"Official Zend Framework 2 git repository","fork":true,"url":"https://api.github.com/repos/macnibblet/zf2","forks_url":"https://api.github.com/repos/macnibblet/zf2/forks","keys_url":"https://api.github.com/repos/macnibblet/zf2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/macnibblet/zf2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/macnibblet/zf2/teams","hooks_url":"https://api.github.com/repos/macnibblet/zf2/hooks","issue_events_url":"https://api.github.com/repos/macnibblet/zf2/issues/events{/number}","events_url":"https://api.github.com/repos/macnibblet/zf2/events","assignees_url":"https://api.github.com/repos/macnibblet/zf2/assignees{/user}","branches_url":"https://api.github.com/repos/macnibblet/zf2/branches{/branch}","tags_url":"https://api.github.com/repos/macnibblet/zf2/tags","blobs_url":"https://api.github.com/repos/macnibblet/zf2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/macnibblet/zf2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/macnibblet/zf2/git/refs{/sha}","trees_url":"https://api.github.com/repos/macnibblet/zf2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/macnibblet/zf2/statuses/{sha}","languages_url":"https://api.github.com/repos/macnibblet/zf2/languages","stargazers_url":"https://api.github.com/repos/macnibblet/zf2/stargazers","contributors_url":"https://api.github.com/repos/macnibblet/zf2/contributors","subscribers_url":"https://api.github.com/repos/macnibblet/zf2/subscribers","subscription_url":"https://api.github.com/repos/macnibblet/zf2/subscription","commits_url":"https://api.github.com/repos/macnibblet/zf2/commits{/sha}","git_commits_url":"https://api.github.com/repos/macnibblet/zf2/git/commits{/sha}","comments_url":"https://api.github.com/repos/macnibblet/zf2/comments{/number}","issue_comment_url":"https://api.github.com/repos/macnibblet/zf2/issues/comments/{number}","contents_url":"https://api.github.com/repos/macnibblet/zf2/contents/{+path}","compare_url":"https://api.github.com/repos/macnibblet/zf2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/macnibblet/zf2/merges","archive_url":"https://api.github.com/repos/macnibblet/zf2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/macnibblet/zf2/downloads","issues_url":"https://api.github.com/repos/macnibblet/zf2/issues{/number}","pulls_url":"https://api.github.com/repos/macnibblet/zf2/pulls{/number}","milestones_url":"https://api.github.com/repos/macnibblet/zf2/milestones{/number}","notifications_url":"https://api.github.com/repos/macnibblet/zf2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/macnibblet/zf2/labels{/name}","releases_url":"https://api.github.com/repos/macnibblet/zf2/releases{/id}","created_at":"2014-10-31T14:41:19Z","updated_at":"2014-11-19T17:58:07Z","pushed_at":"2015-01-09T10:30:03Z","git_url":"git://github.com/macnibblet/zf2.git","ssh_url":"git@github.com:macnibblet/zf2.git","clone_url":"https://github.com/macnibblet/zf2.git","svn_url":"https://github.com/macnibblet/zf2","homepage":"http://framework.zend.com/","size":93883,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zendframework:master","ref":"master","sha":"6251712072af1d942a94f14a1595b139a70aaee8","user":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"repo":{"id":702550,"name":"zf2","full_name":"zendframework/zf2","owner":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendframework/zf2","description":"Official Zend Framework 2 git repository","fork":false,"url":"https://api.github.com/repos/zendframework/zf2","forks_url":"https://api.github.com/repos/zendframework/zf2/forks","keys_url":"https://api.github.com/repos/zendframework/zf2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendframework/zf2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendframework/zf2/teams","hooks_url":"https://api.github.com/repos/zendframework/zf2/hooks","issue_events_url":"https://api.github.com/repos/zendframework/zf2/issues/events{/number}","events_url":"https://api.github.com/repos/zendframework/zf2/events","assignees_url":"https://api.github.com/repos/zendframework/zf2/assignees{/user}","branches_url":"https://api.github.com/repos/zendframework/zf2/branches{/branch}","tags_url":"https://api.github.com/repos/zendframework/zf2/tags","blobs_url":"https://api.github.com/repos/zendframework/zf2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendframework/zf2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendframework/zf2/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendframework/zf2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendframework/zf2/statuses/{sha}","languages_url":"https://api.github.com/repos/zendframework/zf2/languages","stargazers_url":"https://api.github.com/repos/zendframework/zf2/stargazers","contributors_url":"https://api.github.com/repos/zendframework/zf2/contributors","subscribers_url":"https://api.github.com/repos/zendframework/zf2/subscribers","subscription_url":"https://api.github.com/repos/zendframework/zf2/subscription","commits_url":"https://api.github.com/repos/zendframework/zf2/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendframework/zf2/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendframework/zf2/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendframework/zf2/issues/comments/{number}","contents_url":"https://api.github.com/repos/zendframework/zf2/contents/{+path}","compare_url":"https://api.github.com/repos/zendframework/zf2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendframework/zf2/merges","archive_url":"https://api.github.com/repos/zendframework/zf2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendframework/zf2/downloads","issues_url":"https://api.github.com/repos/zendframework/zf2/issues{/number}","pulls_url":"https://api.github.com/repos/zendframework/zf2/pulls{/number}","milestones_url":"https://api.github.com/repos/zendframework/zf2/milestones{/number}","notifications_url":"https://api.github.com/repos/zendframework/zf2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendframework/zf2/labels{/name}","releases_url":"https://api.github.com/repos/zendframework/zf2/releases{/id}","created_at":"2010-06-04T02:42:05Z","updated_at":"2015-01-19T11:02:41Z","pushed_at":"2015-01-18T18:30:55Z","git_url":"git://github.com/zendframework/zf2.git","ssh_url":"git@github.com:zendframework/zf2.git","clone_url":"https://github.com/zendframework/zf2.git","svn_url":"https://github.com/zendframework/zf2","homepage":"http://framework.zend.com/","size":219752,"stargazers_count":4980,"watchers_count":4980,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3034,"mirror_url":null,"open_issues_count":593,"forks":3034,"open_issues":593,"watchers":4980,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/6925"},"html":{"href":"https://github.com/zendframework/zf2/pull/6925"},"issue":{"href":"https://api.github.com/repos/zendframework/zf2/issues/6925"},"comments":{"href":"https://api.github.com/repos/zendframework/zf2/issues/6925/comments"},"review_comments":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/6925/comments"},"review_comment":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/zendframework/zf2/pulls/6925/commits"},"statuses":{"href":"https://api.github.com/repos/zendframework/zf2/statuses/1a2f4536d8197a39776d0d9fc922b8c79889a76b"}}}}