-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpacl_test.go
77 lines (58 loc) · 1.57 KB
/
pacl_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package paclsk
import (
"testing"
)
// test configuration parameters
const TestNumKeys = 512
const TestNumSubkeys = 10 // for inclusion predicate only
const TestFSSDomain = 32
const TestPredicate = Inclusion
const StatSecPar = 128
const NumQueries = 100 // number of queries to run
func TestProveAuditVerify(t *testing.T) {
for i := 0; i < NumQueries; i++ {
kl, key, _, keyIdx := GenerateTestingKeyList(
TestNumKeys, TestFSSDomain, TestPredicate, TestNumSubkeys)
proofShares := kl.NewProof(keyIdx, key)
auditA := kl.Audit(proofShares[0])
auditB := kl.Audit(proofShares[1])
if !kl.CheckAudit(auditA, auditB) {
t.Fatalf("CheckAudit failed")
}
}
}
func BenchmarkBaseline(b *testing.B) {
numKeys := uint64(1000)
fssDomain := uint(32)
kl, x, _ := GenerateBenchmarkKeyList(
numKeys, fssDomain, TestPredicate, TestNumSubkeys)
shares := kl.NewProof(0, x)
b.ResetTimer()
for i := 0; i < b.N; i++ {
kl.ExpandDPF(shares[0])
}
}
func BenchmarkPACLSingle(b *testing.B) {
numKeys := uint64(1)
fssDomain := uint(32)
kl, x, _ := GenerateBenchmarkKeyList(
numKeys, fssDomain, TestPredicate, TestNumSubkeys)
shares := kl.NewProof(0, x)
b.ResetTimer()
for i := 0; i < b.N; i++ {
audit := kl.Audit(shares[0])
kl.CheckAudit(audit, audit)
}
}
func BenchmarkPACLMany(b *testing.B) {
numKeys := uint64(1000)
fssDomain := uint(32)
kl, x, _ := GenerateBenchmarkKeyList(
numKeys, fssDomain, TestPredicate, TestNumSubkeys)
shares := kl.NewProof(0, x)
b.ResetTimer()
for i := 0; i < b.N; i++ {
audit := kl.Audit(shares[0])
kl.CheckAudit(audit, audit)
}
}