-
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.
Merge pull request #14 from markkurossi/topic/streamer_mem
Topic/streamer mem
- Loading branch information
Showing
45 changed files
with
1,380 additions
and
845 deletions.
There are no files selected for viewing
Binary file not shown.
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/aes" | ||
) | ||
|
||
func main(key, data [16]byte) []byte { | ||
return aes.EncryptBlock(key, data) | ||
} |
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/aes" | ||
) | ||
|
||
func main(key, data [16]byte) []byte { | ||
return aes.Block128(key, data) | ||
} |
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/aes" | ||
) | ||
|
||
func main(key, data [16]byte) []uint { | ||
return aes.ExpandEncryptionKey(key) | ||
} |
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,43 @@ | ||
// -*- go -*- | ||
|
||
// Run the Evaluator with two inputs: evaluator's key and nonce shares: | ||
// | ||
// $ ./garbled -e -i 0x8cd98b88adab08d6d60fe57c8b8a33f3,0xfd5e0f8f155e7102aa526ad0 examples/encrypt.mpcl | ||
// | ||
// The Garbler takes three arguments: the message to encrypt, and its | ||
// key and nonce shares: | ||
// | ||
// $ ./garbled -i 0x48656c6c6f2c20776f726c6421,0xed800b17b0c9d2334b249332155ddef5,0xa300751458c775a08762c2cd examples/encrypt.mpcl | ||
|
||
package main | ||
|
||
import ( | ||
"crypto/cipher/gcm" | ||
) | ||
|
||
type Garbler struct { | ||
msg [64]byte | ||
keyShare [16]byte | ||
nonceShare [12]byte | ||
} | ||
|
||
type Evaluator struct { | ||
keyShare [16]byte | ||
nonceShare [12]byte | ||
} | ||
|
||
func main(g Garbler, e Evaluator) []byte { | ||
var key [16]byte | ||
|
||
for i := 0; i < len(key); i++ { | ||
key[i] = g.keyShare[i] ^ e.keyShare[i] | ||
} | ||
|
||
var nonce [12]byte | ||
|
||
for i := 0; i < len(nonce); i++ { | ||
nonce[i] = g.nonceShare[i] ^ e.nonceShare[i] | ||
} | ||
|
||
return gcm.EncryptAES128(key, nonce, g.msg, []byte("unused")) | ||
} |
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
Oops, something went wrong.