{"action":"created","comment":{"url":"https://api.github.com/repos/dedis/kyber/pulls/comments/215217706","pull_request_review_id":152432945,"id":215217706,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTIxNzcwNg==","diff_hunk":"@@ -426,3 +410,69 @@ func RecoverCommit(g kyber.Group, shares []*PubShare, t, n int) (kyber.Point, er\n \n \treturn Acc, nil\n }\n+\n+// RecoverPubPoly reconstructs the full public polynomial from a set of public\n+// shares using Lagrange interpolation.\n+func RecoverPubPoly(g kyber.Group, shares []*PubShare, t, n int) (*PubPoly, error) {\n+\tx := make(map[int]kyber.Scalar)\n+\tfor i, s := range shares {\n+\t\tif s == nil || s.V == nil || s.I < 0 || n <= s.I {\n+\t\t\tcontinue\n+\t\t}\n+\t\tx[i] = g.Scalar().SetInt64(1 + int64(s.I))\n+\t}\n+\n+\tif len(x) < t {\n+\t\treturn nil, errors.New(\"share: not enough good public shares to reconstruct secret commitment\")\n+\t}\n+\n+\tvar accPoly *PubPoly\n+\tvar err error\n+\n+\tfor j := range x {\n+\t\tbasis := LagrangeBasis(g, j, x)\n+\t\t// compute the L_j * y_j polynomial in point space\n+\t\ttmp := basis.Commit(shares[j].V)\n+\t\tif accPoly == nil {\n+\t\t\taccPoly = tmp\n+\t\t\tcontinue\n+\t\t}\n+\n+\t\t// add all L_j * y_j together\n+\t\taccPoly, err = accPoly.Add(tmp)\n+\t\tif err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\n+\treturn accPoly, nil\n+\n+}\n+\n+// LagrangeBasis returns a PriPoly containing the Lagrange coefficients for the\n+// i-th position. xs is a mapping between the indices and the values that the\n+// interpolation is using, computed with xScalar().\n+func LagrangeBasis(g kyber.Group, i int, xs map[int]kyber.Scalar) *PriPoly {","path":"share/poly.go","position":80,"original_position":80,"commit_id":"4b0615f52d0d961ac3b7df304a2c5f338ba3325a","original_commit_id":"4b0615f52d0d961ac3b7df304a2c5f338ba3325a","user":{"login":"nikkolasg","id":2564747,"node_id":"MDQ6VXNlcjI1NjQ3NDc=","avatar_url":"https://avatars2.githubusercontent.com/u/2564747?v=4","gravatar_id":"","url":"https://api.github.com/users/nikkolasg","html_url":"https://github.com/nikkolasg","followers_url":"https://api.github.com/users/nikkolasg/followers","following_url":"https://api.github.com/users/nikkolasg/following{/other_user}","gists_url":"https://api.github.com/users/nikkolasg/gists{/gist_id}","starred_url":"https://api.github.com/users/nikkolasg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikkolasg/subscriptions","organizations_url":"https://api.github.com/users/nikkolasg/orgs","repos_url":"https://api.github.com/users/nikkolasg/repos","events_url":"https://api.github.com/users/nikkolasg/events{/privacy}","received_events_url":"https://api.github.com/users/nikkolasg/received_events","type":"User","site_admin":false},"body":"Good point, it'll be enough if we don't export it. I'll do that.","created_at":"2018-09-05T10:36:09Z","updated_at":"2018-09-05T10:36:09Z","html_url":"https://github.com/dedis/kyber/pull/322#discussion_r215217706","pull_request_url":"https://api.github.com/repos/dedis/kyber/pulls/322","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dedis/kyber/pulls/comments/215217706"},"html":{"href":"https://github.com/dedis/kyber/pull/322#discussion_r215217706"},"pull_request":{"href":"https://api.github.com/repos/dedis/kyber/pulls/322"}},"in_reply_to_id":215213166},"pull_request":{"url":"https://api.github.com/repos/dedis/kyber/pulls/322","id":213221328,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzMjIxMzI4","html_url":"https://github.com/dedis/kyber/pull/322","diff_url":"https://github.com/dedis/kyber/pull/322.diff","patch_url":"https://github.com/dedis/kyber/pull/322.patch","issue_url":"https://api.github.com/repos/dedis/kyber/issues/322","number":322,"state":"open","locked":false,"title":"Implementation of recovering public polynomial","user":{"login":"nikkolasg","id":2564747,"node_id":"MDQ6VXNlcjI1NjQ3NDc=","avatar_url":"https://avatars2.githubusercontent.com/u/2564747?v=4","gravatar_id":"","url":"https://api.github.com/users/nikkolasg","html_url":"https://github.com/nikkolasg","followers_url":"https://api.github.com/users/nikkolasg/followers","following_url":"https://api.github.com/users/nikkolasg/following{/other_user}","gists_url":"https://api.github.com/users/nikkolasg/gists{/gist_id}","starred_url":"https://api.github.com/users/nikkolasg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikkolasg/subscriptions","organizations_url":"https://api.github.com/users/nikkolasg/orgs","repos_url":"https://api.github.com/users/nikkolasg/repos","events_url":"https://api.github.com/users/nikkolasg/events{/privacy}","received_events_url":"https://api.github.com/users/nikkolasg/received_events","type":"User","site_admin":false},"body":"This PR implements the recovering of a public polynomial (ie. all its coefficients) from a list of public shares. This is needed for the newest features coming into DKG. ","created_at":"2018-09-05T09:11:18Z","updated_at":"2018-09-05T10:36:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d924175babdbd928fcb32ee679cb925f98710740","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dedis/kyber/pulls/322/commits","review_comments_url":"https://api.github.com/repos/dedis/kyber/pulls/322/comments","review_comment_url":"https://api.github.com/repos/dedis/kyber/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dedis/kyber/issues/322/comments","statuses_url":"https://api.github.com/repos/dedis/kyber/statuses/4b0615f52d0d961ac3b7df304a2c5f338ba3325a","head":{"label":"dedis:pubpoly","ref":"pubpoly","sha":"4b0615f52d0d961ac3b7df304a2c5f338ba3325a","user":{"login":"dedis","id":3638331,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MzgzMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/3638331?v=4","gravatar_id":"","url":"https://api.github.com/users/dedis","html_url":"https://github.com/dedis","followers_url":"https://api.github.com/users/dedis/followers","following_url":"https://api.github.com/users/dedis/following{/other_user}","gists_url":"https://api.github.com/users/dedis/gists{/gist_id}","starred_url":"https://api.github.com/users/dedis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dedis/subscriptions","organizations_url":"https://api.github.com/users/dedis/orgs","repos_url":"https://api.github.com/users/dedis/repos","events_url":"https://api.github.com/users/dedis/events{/privacy}","received_events_url":"https://api.github.com/users/dedis/received_events","type":"Organization","site_admin":false},"repo":{"id":25253455,"node_id":"MDEwOlJlcG9zaXRvcnkyNTI1MzQ1NQ==","name":"kyber","full_name":"dedis/kyber","owner":{"login":"dedis","id":3638331,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MzgzMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/3638331?v=4","gravatar_id":"","url":"https://api.github.com/users/dedis","html_url":"https://github.com/dedis","followers_url":"https://api.github.com/users/dedis/followers","following_url":"https://api.github.com/users/dedis/following{/other_user}","gists_url":"https://api.github.com/users/dedis/gists{/gist_id}","starred_url":"https://api.github.com/users/dedis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dedis/subscriptions","organizations_url":"https://api.github.com/users/dedis/orgs","repos_url":"https://api.github.com/users/dedis/repos","events_url":"https://api.github.com/users/dedis/events{/privacy}","received_events_url":"https://api.github.com/users/dedis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dedis/kyber","description":"Advanced crypto library for the Go language","fork":false,"url":"https://api.github.com/repos/dedis/kyber","forks_url":"https://api.github.com/repos/dedis/kyber/forks","keys_url":"https://api.github.com/repos/dedis/kyber/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dedis/kyber/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dedis/kyber/teams","hooks_url":"https://api.github.com/repos/dedis/kyber/hooks","issue_events_url":"https://api.github.com/repos/dedis/kyber/issues/events{/number}","events_url":"https://api.github.com/repos/dedis/kyber/events","assignees_url":"https://api.github.com/repos/dedis/kyber/assignees{/user}","branches_url":"https://api.github.com/repos/dedis/kyber/branches{/branch}","tags_url":"https://api.github.com/repos/dedis/kyber/tags","blobs_url":"https://api.github.com/repos/dedis/kyber/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dedis/kyber/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dedis/kyber/git/refs{/sha}","trees_url":"https://api.github.com/repos/dedis/kyber/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dedis/kyber/statuses/{sha}","languages_url":"https://api.github.com/repos/dedis/kyber/languages","stargazers_url":"https://api.github.com/repos/dedis/kyber/stargazers","contributors_url":"https://api.github.com/repos/dedis/kyber/contributors","subscribers_url":"https://api.github.com/repos/dedis/kyber/subscribers","subscription_url":"https://api.github.com/repos/dedis/kyber/subscription","commits_url":"https://api.github.com/repos/dedis/kyber/commits{/sha}","git_commits_url":"https://api.github.com/repos/dedis/kyber/git/commits{/sha}","comments_url":"https://api.github.com/repos/dedis/kyber/comments{/number}","issue_comment_url":"https://api.github.com/repos/dedis/kyber/issues/comments{/number}","contents_url":"https://api.github.com/repos/dedis/kyber/contents/{+path}","compare_url":"https://api.github.com/repos/dedis/kyber/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dedis/kyber/merges","archive_url":"https://api.github.com/repos/dedis/kyber/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dedis/kyber/downloads","issues_url":"https://api.github.com/repos/dedis/kyber/issues{/number}","pulls_url":"https://api.github.com/repos/dedis/kyber/pulls{/number}","milestones_url":"https://api.github.com/repos/dedis/kyber/milestones{/number}","notifications_url":"https://api.github.com/repos/dedis/kyber/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dedis/kyber/labels{/name}","releases_url":"https://api.github.com/repos/dedis/kyber/releases{/id}","deployments_url":"https://api.github.com/repos/dedis/kyber/deployments","created_at":"2014-10-15T12:25:03Z","updated_at":"2018-09-03T12:07:11Z","pushed_at":"2018-09-05T09:52:58Z","git_url":"git://github.com/dedis/kyber.git","ssh_url":"git@github.com:dedis/kyber.git","clone_url":"https://github.com/dedis/kyber.git","svn_url":"https://github.com/dedis/kyber","homepage":"","size":7426,"stargazers_count":185,"watchers_count":185,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":47,"open_issues":20,"watchers":185,"default_branch":"master"}},"base":{"label":"dedis:master","ref":"master","sha":"4b882c2d31af928e7b449e0be8b27b573c2da82d","user":{"login":"dedis","id":3638331,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MzgzMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/3638331?v=4","gravatar_id":"","url":"https://api.github.com/users/dedis","html_url":"https://github.com/dedis","followers_url":"https://api.github.com/users/dedis/followers","following_url":"https://api.github.com/users/dedis/following{/other_user}","gists_url":"https://api.github.com/users/dedis/gists{/gist_id}","starred_url":"https://api.github.com/users/dedis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dedis/subscriptions","organizations_url":"https://api.github.com/users/dedis/orgs","repos_url":"https://api.github.com/users/dedis/repos","events_url":"https://api.github.com/users/dedis/events{/privacy}","received_events_url":"https://api.github.com/users/dedis/received_events","type":"Organization","site_admin":false},"repo":{"id":25253455,"node_id":"MDEwOlJlcG9zaXRvcnkyNTI1MzQ1NQ==","name":"kyber","full_name":"dedis/kyber","owner":{"login":"dedis","id":3638331,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MzgzMzE=","avatar_url":"https://avatars2.githubusercontent.com/u/3638331?v=4","gravatar_id":"","url":"https://api.github.com/users/dedis","html_url":"https://github.com/dedis","followers_url":"https://api.github.com/users/dedis/followers","following_url":"https://api.github.com/users/dedis/following{/other_user}","gists_url":"https://api.github.com/users/dedis/gists{/gist_id}","starred_url":"https://api.github.com/users/dedis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dedis/subscriptions","organizations_url":"https://api.github.com/users/dedis/orgs","repos_url":"https://api.github.com/users/dedis/repos","events_url":"https://api.github.com/users/dedis/events{/privacy}","received_events_url":"https://api.github.com/users/dedis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dedis/kyber","description":"Advanced crypto library for the Go language","fork":false,"url":"https://api.github.com/repos/dedis/kyber","forks_url":"https://api.github.com/repos/dedis/kyber/forks","keys_url":"https://api.github.com/repos/dedis/kyber/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dedis/kyber/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dedis/kyber/teams","hooks_url":"https://api.github.com/repos/dedis/kyber/hooks","issue_events_url":"https://api.github.com/repos/dedis/kyber/issues/events{/number}","events_url":"https://api.github.com/repos/dedis/kyber/events","assignees_url":"https://api.github.com/repos/dedis/kyber/assignees{/user}","branches_url":"https://api.github.com/repos/dedis/kyber/branches{/branch}","tags_url":"https://api.github.com/repos/dedis/kyber/tags","blobs_url":"https://api.github.com/repos/dedis/kyber/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dedis/kyber/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dedis/kyber/git/refs{/sha}","trees_url":"https://api.github.com/repos/dedis/kyber/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dedis/kyber/statuses/{sha}","languages_url":"https://api.github.com/repos/dedis/kyber/languages","stargazers_url":"https://api.github.com/repos/dedis/kyber/stargazers","contributors_url":"https://api.github.com/repos/dedis/kyber/contributors","subscribers_url":"https://api.github.com/repos/dedis/kyber/subscribers","subscription_url":"https://api.github.com/repos/dedis/kyber/subscription","commits_url":"https://api.github.com/repos/dedis/kyber/commits{/sha}","git_commits_url":"https://api.github.com/repos/dedis/kyber/git/commits{/sha}","comments_url":"https://api.github.com/repos/dedis/kyber/comments{/number}","issue_comment_url":"https://api.github.com/repos/dedis/kyber/issues/comments{/number}","contents_url":"https://api.github.com/repos/dedis/kyber/contents/{+path}","compare_url":"https://api.github.com/repos/dedis/kyber/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dedis/kyber/merges","archive_url":"https://api.github.com/repos/dedis/kyber/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dedis/kyber/downloads","issues_url":"https://api.github.com/repos/dedis/kyber/issues{/number}","pulls_url":"https://api.github.com/repos/dedis/kyber/pulls{/number}","milestones_url":"https://api.github.com/repos/dedis/kyber/milestones{/number}","notifications_url":"https://api.github.com/repos/dedis/kyber/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dedis/kyber/labels{/name}","releases_url":"https://api.github.com/repos/dedis/kyber/releases{/id}","deployments_url":"https://api.github.com/repos/dedis/kyber/deployments","created_at":"2014-10-15T12:25:03Z","updated_at":"2018-09-03T12:07:11Z","pushed_at":"2018-09-05T09:52:58Z","git_url":"git://github.com/dedis/kyber.git","ssh_url":"git@github.com:dedis/kyber.git","clone_url":"https://github.com/dedis/kyber.git","svn_url":"https://github.com/dedis/kyber","homepage":"","size":7426,"stargazers_count":185,"watchers_count":185,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":47,"open_issues":20,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dedis/kyber/pulls/322"},"html":{"href":"https://github.com/dedis/kyber/pull/322"},"issue":{"href":"https://api.github.com/repos/dedis/kyber/issues/322"},"comments":{"href":"https://api.github.com/repos/dedis/kyber/issues/322/comments"},"review_comments":{"href":"https://api.github.com/repos/dedis/kyber/pulls/322/comments"},"review_comment":{"href":"https://api.github.com/repos/dedis/kyber/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dedis/kyber/pulls/322/commits"},"statuses":{"href":"https://api.github.com/repos/dedis/kyber/statuses/4b0615f52d0d961ac3b7df304a2c5f338ba3325a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nikkolasg"}}