-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
459597e
commit 981cded
Showing
12 changed files
with
100 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
apps/circuit/circuit | ||
apps/garbled/garbled | ||
apps/ot/ot | ||
apps/iter/iter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// -*- go -*- | ||
|
||
package main | ||
|
||
import ( | ||
"crypto/sha256" | ||
) | ||
|
||
func main(block1, block2 uint512) uint256 { | ||
return sha256.Block(block1, sha256.H0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// main.go | ||
// | ||
// Copyright (c) 2019 Markku Rossi | ||
// | ||
// All rights reserved. | ||
// | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/markkurossi/mpc/compiler" | ||
"github.com/markkurossi/mpc/compiler/utils" | ||
) | ||
|
||
var template = ` | ||
package main | ||
func main(a, b int%d) int { | ||
return a * b | ||
} | ||
` | ||
|
||
func main() { | ||
for bits := 8; bits < 1024; bits += 8 { | ||
code := fmt.Sprintf(template, bits) | ||
var bestLimit int | ||
var bestCost int | ||
|
||
for limit := 4; limit < 64; limit += 2 { | ||
circ, _, err := compiler.NewCompiler(&utils.Params{ | ||
CircMultArrayTreshold: limit, | ||
}).Compile(code) | ||
if err != nil { | ||
log.Fatalf("Compilation %d:%d failed: %s", bits, limit, err) | ||
} | ||
cost := circ.Cost() | ||
|
||
if bestCost == 0 || cost < bestCost { | ||
bestCost = cost | ||
bestLimit = limit | ||
} | ||
} | ||
fmt.Printf("%d\t%d\t%d\n", bits, bestLimit, bestCost) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters