-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheval.go
56 lines (40 loc) · 1.3 KB
/
eval.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
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"math"
"time"
paclsposs "github.com/sachaservan/pacl/pacl-sposs"
)
func main() {
n := []int{262144, 524288, 1048576, 2097152, 4194304, 8388608}
for i, numAccounts := range n {
experiment := &Experiment{
NumKeys: uint64(numAccounts),
}
experiment.AuthTimeMS = make([]int64, 0)
for trial := 0; trial < 10; trial++ {
experiment.AuthTimeMS = append(experiment.AuthTimeMS, benchmarkPACLAuthTime(numAccounts))
fmt.Printf("Finished trial %v of %v\n", trial, 10)
}
fmt.Printf("Auth time @ %v accounts: %v\n", experiment.AuthTimeMS, numAccounts)
experimentJSON, _ := json.MarshalIndent(experiment, "", " ")
ioutil.WriteFile("experiment"+fmt.Sprint(i)+".json", experimentJSON, 0644)
}
}
func benchmarkPACLAuthTime(numAccount int) int64 {
// setup parameters
group := paclsposs.DefaultGroup()
n := uint(math.Log2(float64(numAccount)))
kl, key, idx := paclsposs.GenerateBenchmarkKeyList(
uint64(numAccount), n, group, paclsposs.Equality, 0)
// client-side computation (precomputed here because we're
// benchmarking the server overhead).
shares := kl.NewProof(idx, key)
auditB := kl.Audit(shares[0])
start := time.Now()
auditA := kl.Audit(shares[0])
kl.CheckAudit(auditA, auditB)
return time.Since(start).Milliseconds()
}