{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/212834280","pull_request_review_id":149546222,"id":212834280,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjgzNDI4MA==","diff_hunk":"@@ -0,0 +1,23 @@\n+// Copyright (c) 2018 The Bitcoin Core developers\n+// Distributed under the MIT software license, see the accompanying\n+// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n+\n+#include <crypto/hkdf_sha256_32.h>\n+\n+#include <assert.h>\n+#include <string.h>\n+\n+CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const unsigned char* ikm, size_t ikmlen, const std::string& salt)\n+{\n+    CHMAC_SHA256(reinterpret_cast<const unsigned char*>(salt.c_str()), salt.size()).Write(ikm, ikmlen).Finalize(m_prk);\n+}\n+\n+void CHKDF_HMAC_SHA256_L32::Expand32(const std::string& info, unsigned char* out)\n+{\n+    // expand a 32byte key (single round)\n+    assert(info.size() <= 128);\n+    unsigned char data[129];\n+    memcpy(&data[0], &info[0], info.size());\n+    data[info.size()] = 0x01;\n+    CHMAC_SHA256(m_prk, 32).Write(&data[0], info.size() + 1).Finalize(out);","path":"src/crypto/hkdf_sha256_32.cpp","position":22,"original_position":22,"commit_id":"2130c88d53e725228ad093c56d8bd0b0daa79fed","original_commit_id":"83e435f002a04a11b5283f89cc74626071dbb35b","user":{"login":"sipa","id":548488,"node_id":"MDQ6VXNlcjU0ODQ4OA==","avatar_url":"https://avatars1.githubusercontent.com/u/548488?v=4","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"body":"You can avoid the copy to `data` if you use `static const char one[1] = {1}; CHMAC_SHA256(m_prk, 32).Write(info.data(), info.size()).Write(one, 1).Finalize(out);` instead.","created_at":"2018-08-26T18:09:15Z","updated_at":"2018-08-26T18:09:15Z","html_url":"https://github.com/bitcoin/bitcoin/pull/14047#discussion_r212834280","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/212834280"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/14047#discussion_r212834280"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047","id":210684950,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNjg0OTUw","html_url":"https://github.com/bitcoin/bitcoin/pull/14047","diff_url":"https://github.com/bitcoin/bitcoin/pull/14047.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/14047.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14047","number":14047,"state":"open","locked":false,"title":"Add HKDF_HMAC256_L32 and method to negate a private key","user":{"login":"jonasschnelli","id":178464,"node_id":"MDQ6VXNlcjE3ODQ2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/178464?v=4","gravatar_id":"","url":"https://api.github.com/users/jonasschnelli","html_url":"https://github.com/jonasschnelli","followers_url":"https://api.github.com/users/jonasschnelli/followers","following_url":"https://api.github.com/users/jonasschnelli/following{/other_user}","gists_url":"https://api.github.com/users/jonasschnelli/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasschnelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasschnelli/subscriptions","organizations_url":"https://api.github.com/users/jonasschnelli/orgs","repos_url":"https://api.github.com/users/jonasschnelli/repos","events_url":"https://api.github.com/users/jonasschnelli/events{/privacy}","received_events_url":"https://api.github.com/users/jonasschnelli/received_events","type":"User","site_admin":false},"body":"This adds a limited implementation of `HKDF` (defined by rfc5869) that supports only HMAC-SHA256  and length output of 32 bytes (will be required for BIP151).\r\n\r\nThis PR also includes a method to negate a private key which is useful to enforce public keys starting with 0x02 (or 0x03) (requirement for BIP151). The new `CKey::Negate()` method is pretty much a wrapper around `secp256k1_ec_privkey_negate()`.\r\n\r\nIncluding tests.\r\n\r\nThis is a subset of #14032 and a pre-requirement for BIP151.","created_at":"2018-08-24T09:20:37Z","updated_at":"2018-08-26T18:09:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de7f718ae5f865d427d7d534c054e7d225cb05c3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14047/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/2130c88d53e725228ad093c56d8bd0b0daa79fed","head":{"label":"jonasschnelli:2018/08/bip151_key_hkdf","ref":"2018/08/bip151_key_hkdf","sha":"2130c88d53e725228ad093c56d8bd0b0daa79fed","user":{"login":"jonasschnelli","id":178464,"node_id":"MDQ6VXNlcjE3ODQ2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/178464?v=4","gravatar_id":"","url":"https://api.github.com/users/jonasschnelli","html_url":"https://github.com/jonasschnelli","followers_url":"https://api.github.com/users/jonasschnelli/followers","following_url":"https://api.github.com/users/jonasschnelli/following{/other_user}","gists_url":"https://api.github.com/users/jonasschnelli/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasschnelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasschnelli/subscriptions","organizations_url":"https://api.github.com/users/jonasschnelli/orgs","repos_url":"https://api.github.com/users/jonasschnelli/repos","events_url":"https://api.github.com/users/jonasschnelli/events{/privacy}","received_events_url":"https://api.github.com/users/jonasschnelli/received_events","type":"User","site_admin":false},"repo":{"id":9264454,"node_id":"MDEwOlJlcG9zaXRvcnk5MjY0NDU0","name":"bitcoin","full_name":"jonasschnelli/bitcoin","owner":{"login":"jonasschnelli","id":178464,"node_id":"MDQ6VXNlcjE3ODQ2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/178464?v=4","gravatar_id":"","url":"https://api.github.com/users/jonasschnelli","html_url":"https://github.com/jonasschnelli","followers_url":"https://api.github.com/users/jonasschnelli/followers","following_url":"https://api.github.com/users/jonasschnelli/following{/other_user}","gists_url":"https://api.github.com/users/jonasschnelli/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasschnelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasschnelli/subscriptions","organizations_url":"https://api.github.com/users/jonasschnelli/orgs","repos_url":"https://api.github.com/users/jonasschnelli/repos","events_url":"https://api.github.com/users/jonasschnelli/events{/privacy}","received_events_url":"https://api.github.com/users/jonasschnelli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jonasschnelli/bitcoin","description":"CoreWallet development branch - A better full node wallet for bitcoin-core","fork":true,"url":"https://api.github.com/repos/jonasschnelli/bitcoin","forks_url":"https://api.github.com/repos/jonasschnelli/bitcoin/forks","keys_url":"https://api.github.com/repos/jonasschnelli/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jonasschnelli/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jonasschnelli/bitcoin/teams","hooks_url":"https://api.github.com/repos/jonasschnelli/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/jonasschnelli/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/jonasschnelli/bitcoin/events","assignees_url":"https://api.github.com/repos/jonasschnelli/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/jonasschnelli/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/jonasschnelli/bitcoin/tags","blobs_url":"https://api.github.com/repos/jonasschnelli/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jonasschnelli/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jonasschnelli/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jonasschnelli/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jonasschnelli/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/jonasschnelli/bitcoin/languages","stargazers_url":"https://api.github.com/repos/jonasschnelli/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/jonasschnelli/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/jonasschnelli/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/jonasschnelli/bitcoin/subscription","commits_url":"https://api.github.com/repos/jonasschnelli/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jonasschnelli/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jonasschnelli/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jonasschnelli/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jonasschnelli/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/jonasschnelli/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jonasschnelli/bitcoin/merges","archive_url":"https://api.github.com/repos/jonasschnelli/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jonasschnelli/bitcoin/downloads","issues_url":"https://api.github.com/repos/jonasschnelli/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/jonasschnelli/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/jonasschnelli/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/jonasschnelli/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jonasschnelli/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/jonasschnelli/bitcoin/releases{/id}","deployments_url":"https://api.github.com/repos/jonasschnelli/bitcoin/deployments","created_at":"2013-04-06T18:21:51Z","updated_at":"2018-08-22T17:26:57Z","pushed_at":"2018-08-24T14:56:18Z","git_url":"git://github.com/jonasschnelli/bitcoin.git","ssh_url":"git@github.com:jonasschnelli/bitcoin.git","clone_url":"https://github.com/jonasschnelli/bitcoin.git","svn_url":"https://github.com/jonasschnelli/bitcoin","homepage":"http://www.bitcoin.org","size":108240,"stargazers_count":4,"watchers_count":4,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"bitcoin:master","ref":"master","sha":"540bf8aacc50aae0ea5beb76511905a7d2a3e15f","user":{"login":"bitcoin","id":528860,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODg2MA==","avatar_url":"https://avatars2.githubusercontent.com/u/528860?v=4","gravatar_id":"","url":"https://api.github.com/users/bitcoin","html_url":"https://github.com/bitcoin","followers_url":"https://api.github.com/users/bitcoin/followers","following_url":"https://api.github.com/users/bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoin/subscriptions","organizations_url":"https://api.github.com/users/bitcoin/orgs","repos_url":"https://api.github.com/users/bitcoin/repos","events_url":"https://api.github.com/users/bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoin/received_events","type":"Organization","site_admin":false},"repo":{"id":1181927,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgxOTI3","name":"bitcoin","full_name":"bitcoin/bitcoin","owner":{"login":"bitcoin","id":528860,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODg2MA==","avatar_url":"https://avatars2.githubusercontent.com/u/528860?v=4","gravatar_id":"","url":"https://api.github.com/users/bitcoin","html_url":"https://github.com/bitcoin","followers_url":"https://api.github.com/users/bitcoin/followers","following_url":"https://api.github.com/users/bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoin/subscriptions","organizations_url":"https://api.github.com/users/bitcoin/orgs","repos_url":"https://api.github.com/users/bitcoin/repos","events_url":"https://api.github.com/users/bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitcoin/bitcoin","description":"Bitcoin Core integration/staging tree","fork":false,"url":"https://api.github.com/repos/bitcoin/bitcoin","forks_url":"https://api.github.com/repos/bitcoin/bitcoin/forks","keys_url":"https://api.github.com/repos/bitcoin/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitcoin/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitcoin/bitcoin/teams","hooks_url":"https://api.github.com/repos/bitcoin/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/bitcoin/bitcoin/events","assignees_url":"https://api.github.com/repos/bitcoin/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/bitcoin/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/bitcoin/bitcoin/tags","blobs_url":"https://api.github.com/repos/bitcoin/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitcoin/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitcoin/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitcoin/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/bitcoin/bitcoin/languages","stargazers_url":"https://api.github.com/repos/bitcoin/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/bitcoin/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/bitcoin/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/bitcoin/bitcoin/subscription","commits_url":"https://api.github.com/repos/bitcoin/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitcoin/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitcoin/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/bitcoin/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitcoin/bitcoin/merges","archive_url":"https://api.github.com/repos/bitcoin/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitcoin/bitcoin/downloads","issues_url":"https://api.github.com/repos/bitcoin/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/bitcoin/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/bitcoin/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/bitcoin/bitcoin/releases{/id}","deployments_url":"https://api.github.com/repos/bitcoin/bitcoin/deployments","created_at":"2010-12-19T15:16:43Z","updated_at":"2018-08-26T17:20:13Z","pushed_at":"2018-08-26T18:06:45Z","git_url":"git://github.com/bitcoin/bitcoin.git","ssh_url":"git@github.com:bitcoin/bitcoin.git","clone_url":"https://github.com/bitcoin/bitcoin.git","svn_url":"https://github.com/bitcoin/bitcoin","homepage":"https://bitcoincore.org/en/download","size":111566,"stargazers_count":34265,"watchers_count":34265,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":20729,"mirror_url":null,"archived":false,"open_issues_count":861,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":20729,"open_issues":861,"watchers":34265,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/14047"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/14047"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/14047/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/14047/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/2130c88d53e725228ad093c56d8bd0b0daa79fed"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"sipa"}}