Skip to content

Commit

Permalink
Merge 59b88f9 into 8a548a7
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmis committed Nov 6, 2018
2 parents 8a548a7 + 59b88f9 commit 9e8f16e
Show file tree
Hide file tree
Showing 26 changed files with 372 additions and 343 deletions.
2 changes: 1 addition & 1 deletion lib/diff_privacy.go → lib/diffprivacy/diff_privacy.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package libunlynx
package libunlynxdiffprivacy

import (
"github.com/r0fls/gostats"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package libunlynx_test
package libunlynxdiffprivacy_test

import (
"github.com/lca1/unlynx/lib"
. "github.com/lca1/unlynx/lib/diffprivacy"
"github.com/stretchr/testify/assert"
"testing"
)

// TestAddRmProof tests the generation of the noise values for the differential privacy
func TestGenerateNoiseValues(t *testing.T) {
aux := libunlynx.GenerateNoiseValues(0, 0, 1, 0.005)
aux := GenerateNoiseValues(0, 0, 1, 0.005)
assert.Empty(t, aux)

aux = libunlynx.GenerateNoiseValues(500, 0, 1, 0.005)
aux = GenerateNoiseValues(500, 0, 1, 0.005)

assert.Equal(t, len(aux), 500)

Expand Down
3 changes: 2 additions & 1 deletion lib/proofs/aggregation_proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package libunlynxproofs

import (
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/tools"
"reflect"
)

Expand All @@ -20,7 +21,7 @@ func AggregationProofCreation(responses []libunlynx.FilteredResponseDet, aggrega
func AggregationProofVerification(pap PublishedAggregationProof) bool {
comparisonMap := make(map[libunlynx.GroupingKey]libunlynx.FilteredResponse)
for _, v := range pap.FilteredResponses {
libunlynx.AddInMap(comparisonMap, v.DetTagGroupBy, v.Fr)
libunlynxtools.AddInMap(comparisonMap, v.DetTagGroupBy, v.Fr)
}
return reflect.DeepEqual(comparisonMap, pap.AggregationResults)
}
3 changes: 2 additions & 1 deletion lib/proofs/aggregation_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package libunlynxproofs_test
import (
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"github.com/lca1/unlynx/lib/tools"
"github.com/lca1/unlynx/protocols"
"github.com/stretchr/testify/assert"
"testing"
Expand Down Expand Up @@ -48,7 +49,7 @@ func TestAggregationProof(t *testing.T) {

comparisonMap := make(map[libunlynx.GroupingKey]libunlynx.FilteredResponse)
for _, v := range detResponses {
libunlynx.AddInMap(comparisonMap, v.DetTagGroupBy, v.Fr)
libunlynxtools.AddInMap(comparisonMap, v.DetTagGroupBy, v.Fr)
}

PublishedAggregationProof := libunlynxproofs.AggregationProofCreation(detResponses, comparisonMap)
Expand Down
5 changes: 3 additions & 2 deletions lib/proofs/collective_aggregation_proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package libunlynxproofs

import (
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/tools"
)

// PublishedCollectiveAggregationProof contains all infos about proofs for coll aggregation of filtered responses
Expand All @@ -20,10 +21,10 @@ func CollectiveAggregationProofCreation(aggregated1 map[libunlynx.GroupingKey]li
func CollectiveAggregationProofVerification(pcap PublishedCollectiveAggregationProof) bool {
c1 := make(map[libunlynx.GroupingKey]libunlynx.FilteredResponse)
for i, v := range pcap.Aggregation1 {
libunlynx.AddInMap(c1, i, v)
libunlynxtools.AddInMap(c1, i, v)
}
for _, v := range pcap.Aggregation2 {
libunlynx.AddInMap(c1, v.DetTagGroupBy, v.Fr)
libunlynxtools.AddInMap(c1, v.DetTagGroupBy, v.Fr)
}

//compare maps
Expand Down
7 changes: 4 additions & 3 deletions lib/proofs/collective_aggregation_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package libunlynxproofs_test
import (
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"github.com/lca1/unlynx/lib/tools"
"github.com/lca1/unlynx/protocols"
"github.com/stretchr/testify/assert"
"testing"
Expand Down Expand Up @@ -48,13 +49,13 @@ func TestCollectiveAggregationProof(t *testing.T) {

comparisonMap := make(map[libunlynx.GroupingKey]libunlynx.FilteredResponse)
for _, v := range detResponses {
libunlynx.AddInMap(comparisonMap, v.DetTagGroupBy, v.Fr)
libunlynxtools.AddInMap(comparisonMap, v.DetTagGroupBy, v.Fr)
}

resultingMap := make(map[libunlynx.GroupingKey]libunlynx.FilteredResponse)
for i, v := range comparisonMap {
libunlynx.AddInMap(resultingMap, i, v)
libunlynx.AddInMap(resultingMap, i, v)
libunlynxtools.AddInMap(resultingMap, i, v)
libunlynxtools.AddInMap(resultingMap, i, v)
}

PublishedCollectiveAggregationProof := libunlynxproofs.CollectiveAggregationProofCreation(comparisonMap, detResponses, resultingMap)
Expand Down
15 changes: 8 additions & 7 deletions lib/proofs/shuffling_proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/dedis/kyber/shuffle"
"github.com/dedis/onet/log"
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/shuffle"
)

// PublishedShufflingProof contains all infos about proofs for shuffling of a ciphervector
Expand Down Expand Up @@ -33,15 +34,15 @@ func shuffleProofCreation(inputList, outputList []libunlynx.CipherVector, beta [
if libunlynx.PARALLELIZE {
go func(inputList, outputList []libunlynx.CipherVector, i int) {
defer (*wg1).Done()
libunlynx.CompressProcessResponseMultiple(inputList, outputList, i, e, Xhat, XhatBar, Yhat, YhatBar)
libunlynxshuffle.CompressProcessResponseMultiple(inputList, outputList, i, e, Xhat, XhatBar, Yhat, YhatBar)
}(inputList, outputList, i)
} else {
libunlynx.CompressProcessResponseMultiple(inputList, outputList, i, e, Xhat, XhatBar, Yhat, YhatBar)
libunlynxshuffle.CompressProcessResponseMultiple(inputList, outputList, i, e, Xhat, XhatBar, Yhat, YhatBar)
}
}
libunlynx.EndParallelize(wg1)

betaCompressed := libunlynx.CompressBeta(beta, e)
betaCompressed := libunlynxshuffle.CompressBeta(beta, e)

rand := libunlynx.SuiTe.RandomStream()

Expand Down Expand Up @@ -90,18 +91,18 @@ func ShufflingProofVerification(psp PublishedShufflingProof, seed kyber.Point) b
if libunlynx.PARALLELIZE {
wg := libunlynx.StartParallelize(2)
go func() {
x, y = libunlynx.CompressListProcessResponse(psp.OriginalList, e)
x, y = libunlynxshuffle.CompressListProcessResponse(psp.OriginalList, e)
defer (*wg).Done()
}()
go func() {
xbar, ybar = libunlynx.CompressListProcessResponse(psp.ShuffledList, e)
xbar, ybar = libunlynxshuffle.CompressListProcessResponse(psp.ShuffledList, e)
defer (*wg).Done()
}()

libunlynx.EndParallelize(wg)
} else {
x, y = libunlynx.CompressListProcessResponse(psp.OriginalList, e)
xbar, ybar = libunlynx.CompressListProcessResponse(psp.ShuffledList, e)
x, y = libunlynxshuffle.CompressListProcessResponse(psp.OriginalList, e)
xbar, ybar = libunlynxshuffle.CompressListProcessResponse(psp.ShuffledList, e)
}

return checkShuffleProof(psp.G, psp.H, x, y, xbar, ybar, psp.HashProof)
Expand Down
3 changes: 2 additions & 1 deletion lib/proofs/shuffling_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package libunlynxproofs_test
import (
"github.com/lca1/unlynx/lib"
"github.com/lca1/unlynx/lib/proofs"
"github.com/lca1/unlynx/lib/shuffle"
"github.com/stretchr/testify/assert"
"testing"
)
Expand All @@ -19,7 +20,7 @@ func TestShufflingProof(t *testing.T) {
responses[1] = append(testCipherVect1, testCipherVect1...)
responses[2] = append(testCipherVect2, testCipherVect1...)

responsesShuffled, pi, beta := libunlynx.ShuffleSequence(responses, nil, pubKey, nil)
responsesShuffled, pi, beta := libunlynxshuffle.ShuffleSequence(responses, nil, pubKey, nil)
PublishedShufflingProof := libunlynxproofs.ShufflingProofCreation(responses, responsesShuffled, nil, pubKey, beta, pi)
assert.True(t, libunlynxproofs.ShufflingProofVerification(PublishedShufflingProof, pubKey))

Expand Down

0 comments on commit 9e8f16e

Please sign in to comment.