README.md 1.6 KB
Newer Older
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
1
# Cryptographic Computing - Handin 6
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
2

Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
3
A Go implementation of a passive secure two-party protocol for blood type compatibility based on a homomorphic encryption scheme.
Anders Jensen Løvig's avatar
Builder    
Anders Jensen Løvig committed
4

Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
5
6
## Implementation

Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
7
The protocol is implemented in `cmd/handin6/main.go` with tests in `cmd/handin6/main_test.go`. 
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
8
9
10
11

For the implementation we have implemented support packages which can be reused:
- `internal/crypto/elgamal` implements textbook ElGamal encryption.
- `internal/crypto/oblivious` implements a 1 out of n oblivious transfer protocol.
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
12
13
14
15
16
17
18
19
- `internal/crypto/garbled` implements Yao's garbled circuits.
- `internal/crypto/homomorphic` implements the homomorphic encryption scheme.

### Notes on implementation.

1. For the security parameters we choose 200-bit p, 10^6-bit q, 40-bit r and 1000 elements in the public key. We choose those values
   because they improve the performance of the scheme, and everything still works.

Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
20
21
22
2. In the homomorphic encryption scheme, we need to choose a random subset S. We do this by shuffling a list containing the numbers [1,...,n] 
   and then choosing the k first numbers in the list, where k is a random integer in the range [1,...,n). This ensures we always add some      
   noise to the encryption.
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
23
24
25
26
27
28
29
30
31

## Requirements

The protocol is tested using [Go 1.17](https://golang.org/dl/), but will likely work with older versions. 

## Run Tests

You can run the tests with go:
``` 
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
32
go test ./cmd/handin6
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
33
```
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
34
This executes the protocol tests. This includes a test that tries the protocol on all combinations of recipient and donor blood types.
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
35

Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
36
37
38
To run all tests in the repository (could take some time):
``` 
go test ./...
Anders Jensen Løvig's avatar
Anders Jensen Løvig committed
39
```