{"action":"created","comment":{"url":"https://api.github.com/repos/dedis/crypto/pulls/comments/99294580","pull_request_review_id":19966990,"id":99294580,"diff_hunk":"@@ -0,0 +1,109 @@\n+package proof\n+\n+import (\n+\t\"errors\"\n+\n+\t\"github.com/dedis/crypto/abstract\"\n+\t\"github.com/dedis/crypto/hash\"\n+\t\"github.com/dedis/crypto/random\"\n+)\n+\n+// This package provides functionality to create and verify non-interactive\n+// zero-knowledge (NIZK) proofs for the equality (EQ) of discrete logarithms (DL).\n+\n+// DLEQProof represents a NIZK dlog-equality proof.\n+type DLEQProof struct {\n+\tC  abstract.Scalar // challenge\n+\tR  abstract.Scalar // response\n+\tVG abstract.Point  // public commitment with respect to base point G\n+\tVH abstract.Point  // public commitment with respect to base point H\n+}\n+\n+// NewDLEQProof computes a new NIZK dlog-equality proof by randomly selecting a\n+// commitment v, determining the challenge c = H(xG,xH,vG,vH) and the response r\n+// = v - cx. It also returns the encrypted base points xG and xH.\n+func NewDLEQProof(suite abstract.Suite, G abstract.Point, H abstract.Point, x abstract.Scalar) (*DLEQProof, abstract.Point, abstract.Point, error) {\n+\n+\t// Encrypt base points with secret\n+\txG := suite.Point().Mul(G, x)\n+\txH := suite.Point().Mul(H, x)\n+\n+\t// Commitment\n+\tv := suite.Scalar().Pick(random.Stream)\n+\tvG := suite.Point().Mul(G, v)\n+\tvH := suite.Point().Mul(H, v)\n+\n+\t// Challenge\n+\tcb, err := hash.Args(suite.Hash(), xG, xH, vG, vH)\n+\tif err != nil {\n+\t\treturn nil, nil, nil, err\n+\t}\n+\tc := suite.Scalar().Pick(suite.Cipher(cb))\n+\n+\t// Response\n+\tr := suite.Scalar()\n+\tr.Mul(x, c).Sub(v, r)\n+\n+\treturn &DLEQProof{c, r, vG, vH}, xG, xH, nil\n+}\n+\n+// NewDLEQProofBatch computes lists of NIZK dlog-equality proofs and of\n+// encrypted base points xG and xH. Note that the challenge is computed over all\n+// input values.\n+func NewDLEQProofBatch(suite abstract.Suite, G []abstract.Point, H []abstract.Point, secrets []abstract.Scalar) ([]*DLEQProof, []abstract.Point, []abstract.Point, error) {\n+\n+\tif len(G) != len(H) && len(H) != len(secrets) {\n+\t\treturn nil, nil, nil, errors.New(\"inputs of different lengths\")\n+\t}\n+\n+\tn := len(secrets)\n+\tproofs := make([]*DLEQProof, n)\n+\tv := make([]abstract.Scalar, n)\n+\txG := make([]abstract.Point, n)\n+\txH := make([]abstract.Point, n)\n+\tvG := make([]abstract.Point, n)\n+\tvH := make([]abstract.Point, n)\n+\n+\tfor i, x := range secrets {\n+\n+\t\t// Encrypt base points with secrets\n+\t\txG[i] = suite.Point().Mul(G[i], x)\n+\t\txH[i] = suite.Point().Mul(H[i], x)\n+\n+\t\t// Commitments\n+\t\tv[i] = suite.Scalar().Pick(random.Stream)\n+\t\tvG[i] = suite.Point().Mul(G[i], v[i])\n+\t\tvH[i] = suite.Point().Mul(H[i], v[i])\n+\t}\n+\n+\t// Collective challenge\n+\tcb, err := hash.Args(suite.Hash(), xG, xH, vG, vH)\n+\tif err != nil {\n+\t\treturn nil, nil, nil, err\n+\t}\n+\tc := suite.Scalar().Pick(suite.Cipher(cb))\n+\n+\t// Responses\n+\tfor i, x := range secrets {\n+\t\tr := suite.Scalar()\n+\t\tr.Mul(x, c).Sub(v[i], r)\n+\t\tproofs[i] = &DLEQProof{c, r, vG[i], vH[i]}\n+\t}\n+\n+\treturn proofs, xG, xH, nil\n+}\n+\n+// Verify examines the validity of the corresponding NIZK dlog-equality proof\n+// by checking that vG == rG + c(xG) and vH == rH + c(xH).\n+func (p *DLEQProof) Verify(suite abstract.Suite, G abstract.Point, H abstract.Point, xG abstract.Point, xH abstract.Point) bool {\n+\trG := suite.Point().Mul(G, p.R)\n+\trH := suite.Point().Mul(H, p.R)\n+\tcxG := suite.Point().Mul(xG, p.C)\n+\tcxH := suite.Point().Mul(xH, p.C)\n+\ta := suite.Point().Add(rG, cxG)\n+\tb := suite.Point().Add(rH, cxH)\n+\tif p.VG.Equal(a) && p.VH.Equal(b) {\n+\t\treturn true\n+\t}\n+\treturn false","path":"proof/dleq.go","position":108,"original_position":108,"commit_id":"97c5c68c97be566764d9b2aaaa2cab47b986af1f","original_commit_id":"97c5c68c97be566764d9b2aaaa2cab47b986af1f","user":{"login":"Daeinar","id":1496810,"avatar_url":"https://avatars.githubusercontent.com/u/1496810?v=3","gravatar_id":"","url":"https://api.github.com/users/Daeinar","html_url":"https://github.com/Daeinar","followers_url":"https://api.github.com/users/Daeinar/followers","following_url":"https://api.github.com/users/Daeinar/following{/other_user}","gists_url":"https://api.github.com/users/Daeinar/gists{/gist_id}","starred_url":"https://api.github.com/users/Daeinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daeinar/subscriptions","organizations_url":"https://api.github.com/users/Daeinar/orgs","repos_url":"https://api.github.com/users/Daeinar/repos","events_url":"https://api.github.com/users/Daeinar/events{/privacy}","received_events_url":"https://api.github.com/users/Daeinar/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2017-02-03T08:40:52Z","updated_at":"2017-02-03T08:40:52Z","html_url":"https://github.com/dedis/crypto/pull/103#discussion_r99294580","pull_request_url":"https://api.github.com/repos/dedis/crypto/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/dedis/crypto/pulls/comments/99294580"},"html":{"href":"https://github.com/dedis/crypto/pull/103#discussion_r99294580"},"pull_request":{"href":"https://api.github.com/repos/dedis/crypto/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/dedis/crypto/pulls/103","id":104295609,"html_url":"https://github.com/dedis/crypto/pull/103","diff_url":"https://github.com/dedis/crypto/pull/103.diff","patch_url":"https://github.com/dedis/crypto/pull/103.patch","issue_url":"https://api.github.com/repos/dedis/crypto/issues/103","number":103,"state":"open","locked":false,"title":"Utility functions for hashing and discrete log equality proofs","user":{"login":"Daeinar","id":1496810,"avatar_url":"https://avatars.githubusercontent.com/u/1496810?v=3","gravatar_id":"","url":"https://api.github.com/users/Daeinar","html_url":"https://github.com/Daeinar","followers_url":"https://api.github.com/users/Daeinar/followers","following_url":"https://api.github.com/users/Daeinar/following{/other_user}","gists_url":"https://api.github.com/users/Daeinar/gists{/gist_id}","starred_url":"https://api.github.com/users/Daeinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daeinar/subscriptions","organizations_url":"https://api.github.com/users/Daeinar/orgs","repos_url":"https://api.github.com/users/Daeinar/repos","events_url":"https://api.github.com/users/Daeinar/events{/privacy}","received_events_url":"https://api.github.com/users/Daeinar/received_events","type":"User","site_admin":false},"body":"See #96. ","created_at":"2017-02-02T08:50:25Z","updated_at":"2017-02-03T08:40:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccfa7514cf17647d3069f0cd609e174097964e37","assignee":{"login":"Daeinar","id":1496810,"avatar_url":"https://avatars.githubusercontent.com/u/1496810?v=3","gravatar_id":"","url":"https://api.github.com/users/Daeinar","html_url":"https://github.com/Daeinar","followers_url":"https://api.github.com/users/Daeinar/followers","following_url":"https://api.github.com/users/Daeinar/following{/other_user}","gists_url":"https://api.github.com/users/Daeinar/gists{/gist_id}","starred_url":"https://api.github.com/users/Daeinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daeinar/subscriptions","organizations_url":"https://api.github.com/users/Daeinar/orgs","repos_url":"https://api.github.com/users/Daeinar/repos","events_url":"https://api.github.com/users/Daeinar/events{/privacy}","received_events_url":"https://api.github.com/users/Daeinar/received_events","type":"User","site_admin":false},"assignees":[{"login":"Daeinar","id":1496810,"avatar_url":"https://avatars.githubusercontent.com/u/1496810?v=3","gravatar_id":"","url":"https://api.github.com/users/Daeinar","html_url":"https://github.com/Daeinar","followers_url":"https://api.github.com/users/Daeinar/followers","following_url":"https://api.github.com/users/Daeinar/following{/other_user}","gists_url":"https://api.github.com/users/Daeinar/gists{/gist_id}","starred_url":"https://api.github.com/users/Daeinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daeinar/subscriptions","organizations_url":"https://api.github.com/users/Daeinar/orgs","repos_url":"https://api.github.com/users/Daeinar/repos","events_url":"https://api.github.com/users/Daeinar/events{/privacy}","received_events_url":"https://api.github.com/users/Daeinar/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dedis/crypto/pulls/103/commits","review_comments_url":"https://api.github.com/repos/dedis/crypto/pulls/103/comments","review_comment_url":"https://api.github.com/repos/dedis/crypto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dedis/crypto/issues/103/comments","statuses_url":"https://api.github.com/repos/dedis/crypto/statuses/97c5c68c97be566764d9b2aaaa2cab47b986af1f","head":{"label":"dedis:dleq_96","ref":"dleq_96","sha":"97c5c68c97be566764d9b2aaaa2cab47b986af1f","user":{"login":"dedis","id":3638331,"avatar_url":"https://avatars.githubusercontent.com/u/3638331?v=3","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,"name":"crypto","full_name":"dedis/crypto","owner":{"login":"dedis","id":3638331,"avatar_url":"https://avatars.githubusercontent.com/u/3638331?v=3","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/crypto","description":"Advanced crypto library for the Go language","fork":false,"url":"https://api.github.com/repos/dedis/crypto","forks_url":"https://api.github.com/repos/dedis/crypto/forks","keys_url":"https://api.github.com/repos/dedis/crypto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dedis/crypto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dedis/crypto/teams","hooks_url":"https://api.github.com/repos/dedis/crypto/hooks","issue_events_url":"https://api.github.com/repos/dedis/crypto/issues/events{/number}","events_url":"https://api.github.com/repos/dedis/crypto/events","assignees_url":"https://api.github.com/repos/dedis/crypto/assignees{/user}","branches_url":"https://api.github.com/repos/dedis/crypto/branches{/branch}","tags_url":"https://api.github.com/repos/dedis/crypto/tags","blobs_url":"https://api.github.com/repos/dedis/crypto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dedis/crypto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dedis/crypto/git/refs{/sha}","trees_url":"https://api.github.com/repos/dedis/crypto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dedis/crypto/statuses/{sha}","languages_url":"https://api.github.com/repos/dedis/crypto/languages","stargazers_url":"https://api.github.com/repos/dedis/crypto/stargazers","contributors_url":"https://api.github.com/repos/dedis/crypto/contributors","subscribers_url":"https://api.github.com/repos/dedis/crypto/subscribers","subscription_url":"https://api.github.com/repos/dedis/crypto/subscription","commits_url":"https://api.github.com/repos/dedis/crypto/commits{/sha}","git_commits_url":"https://api.github.com/repos/dedis/crypto/git/commits{/sha}","comments_url":"https://api.github.com/repos/dedis/crypto/comments{/number}","issue_comment_url":"https://api.github.com/repos/dedis/crypto/issues/comments{/number}","contents_url":"https://api.github.com/repos/dedis/crypto/contents/{+path}","compare_url":"https://api.github.com/repos/dedis/crypto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dedis/crypto/merges","archive_url":"https://api.github.com/repos/dedis/crypto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dedis/crypto/downloads","issues_url":"https://api.github.com/repos/dedis/crypto/issues{/number}","pulls_url":"https://api.github.com/repos/dedis/crypto/pulls{/number}","milestones_url":"https://api.github.com/repos/dedis/crypto/milestones{/number}","notifications_url":"https://api.github.com/repos/dedis/crypto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dedis/crypto/labels{/name}","releases_url":"https://api.github.com/repos/dedis/crypto/releases{/id}","deployments_url":"https://api.github.com/repos/dedis/crypto/deployments","created_at":"2014-10-15T12:25:03Z","updated_at":"2017-02-01T09:29:12Z","pushed_at":"2017-02-03T08:40:09Z","git_url":"git://github.com/dedis/crypto.git","ssh_url":"git@github.com:dedis/crypto.git","clone_url":"https://github.com/dedis/crypto.git","svn_url":"https://github.com/dedis/crypto","homepage":"","size":5351,"stargazers_count":76,"watchers_count":76,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":17,"forks":17,"open_issues":17,"watchers":76,"default_branch":"master"}},"base":{"label":"dedis:master","ref":"master","sha":"8ce10dbe198a45fee96fcd3f600e324df5e71b02","user":{"login":"dedis","id":3638331,"avatar_url":"https://avatars.githubusercontent.com/u/3638331?v=3","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,"name":"crypto","full_name":"dedis/crypto","owner":{"login":"dedis","id":3638331,"avatar_url":"https://avatars.githubusercontent.com/u/3638331?v=3","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/crypto","description":"Advanced crypto library for the Go language","fork":false,"url":"https://api.github.com/repos/dedis/crypto","forks_url":"https://api.github.com/repos/dedis/crypto/forks","keys_url":"https://api.github.com/repos/dedis/crypto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dedis/crypto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dedis/crypto/teams","hooks_url":"https://api.github.com/repos/dedis/crypto/hooks","issue_events_url":"https://api.github.com/repos/dedis/crypto/issues/events{/number}","events_url":"https://api.github.com/repos/dedis/crypto/events","assignees_url":"https://api.github.com/repos/dedis/crypto/assignees{/user}","branches_url":"https://api.github.com/repos/dedis/crypto/branches{/branch}","tags_url":"https://api.github.com/repos/dedis/crypto/tags","blobs_url":"https://api.github.com/repos/dedis/crypto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dedis/crypto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dedis/crypto/git/refs{/sha}","trees_url":"https://api.github.com/repos/dedis/crypto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dedis/crypto/statuses/{sha}","languages_url":"https://api.github.com/repos/dedis/crypto/languages","stargazers_url":"https://api.github.com/repos/dedis/crypto/stargazers","contributors_url":"https://api.github.com/repos/dedis/crypto/contributors","subscribers_url":"https://api.github.com/repos/dedis/crypto/subscribers","subscription_url":"https://api.github.com/repos/dedis/crypto/subscription","commits_url":"https://api.github.com/repos/dedis/crypto/commits{/sha}","git_commits_url":"https://api.github.com/repos/dedis/crypto/git/commits{/sha}","comments_url":"https://api.github.com/repos/dedis/crypto/comments{/number}","issue_comment_url":"https://api.github.com/repos/dedis/crypto/issues/comments{/number}","contents_url":"https://api.github.com/repos/dedis/crypto/contents/{+path}","compare_url":"https://api.github.com/repos/dedis/crypto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dedis/crypto/merges","archive_url":"https://api.github.com/repos/dedis/crypto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dedis/crypto/downloads","issues_url":"https://api.github.com/repos/dedis/crypto/issues{/number}","pulls_url":"https://api.github.com/repos/dedis/crypto/pulls{/number}","milestones_url":"https://api.github.com/repos/dedis/crypto/milestones{/number}","notifications_url":"https://api.github.com/repos/dedis/crypto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dedis/crypto/labels{/name}","releases_url":"https://api.github.com/repos/dedis/crypto/releases{/id}","deployments_url":"https://api.github.com/repos/dedis/crypto/deployments","created_at":"2014-10-15T12:25:03Z","updated_at":"2017-02-01T09:29:12Z","pushed_at":"2017-02-03T08:40:09Z","git_url":"git://github.com/dedis/crypto.git","ssh_url":"git@github.com:dedis/crypto.git","clone_url":"https://github.com/dedis/crypto.git","svn_url":"https://github.com/dedis/crypto","homepage":"","size":5351,"stargazers_count":76,"watchers_count":76,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":17,"forks":17,"open_issues":17,"watchers":76,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dedis/crypto/pulls/103"},"html":{"href":"https://github.com/dedis/crypto/pull/103"},"issue":{"href":"https://api.github.com/repos/dedis/crypto/issues/103"},"comments":{"href":"https://api.github.com/repos/dedis/crypto/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/dedis/crypto/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/dedis/crypto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dedis/crypto/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/dedis/crypto/statuses/97c5c68c97be566764d9b2aaaa2cab47b986af1f"}}}}
{"actor":{"display_login":"Daeinar"}}