Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • au619265/cryptographic-computing
1 result
Show changes
Commits on Source (7)
Run Main.java, which will run 10 times with random blood types and then use d-HE to do the compatibility and then check if the result was correct.
Running the tests might take a while and the number of tests can be changed in Main.java
For choosing this subset we do the following:
1. Choose a random value $y$ which is going to be the length of $S$
2. Then we shuffle the list of public keys $(y_1,\dots,y_n)$ randomly
3. Then pick the first $y$ elements in the shuffled list this is then our subset $S$
Security of this in terms of the encryption, since we choose the size of S randomly and the choice of pk's is uniformly random since we shuffle the list of pk's randomly. Then an adversary wouldn't be able to differentiate the sum of the pk's with a random value added to the message.
1. Choose a random value y which is going to be the length of S
2. Then we shuffle the list of public keys (y_1,...,y_n) randomly
3. Then pick the first y elements in the shuffled list this is then our subset S
Security of this in terms of the encryption, since we choose the size of S randomly
and the choice of yi's is uniformly random since we shuffle the list of yi's randomly.
Then an adversary wouldn't be able to differentiate the sum of the yi's with a random
value added to the message.
......@@ -2,17 +2,25 @@
public class Main {
public static void main(String[] args) {
var numOfTests = 10
var failed = false;
for (int i = 0; i < numOfTests; i++) {
var bob = new Bob();
var alice = new Alice();
var helper = new Helper();
var bob = new Bob();
var alice = new Alice();
var helper = new Helper();
bob.receive_bloodType_and_pks_from_Alice(alice.enc_bloodType(), alice.keyPair.pk_list);
bob.enc_own_bloodType();
var c_res = bob.run_function_on_encrypted_input(alice.keyPair.p);
var result = alice.get_result_and_decrypt(c_res);
System.out.println("RESULT: " + result + " : "+ alice.bloodType + " : " + bob.bloodType);
System.out.println("TEST: " + helper.test_function(alice.bloodType, bob.bloodType));
bob.receive_bloodType_and_pks_from_Alice(alice.enc_bloodType(), alice.keyPair.pk_list);
bob.enc_own_bloodType();
var c_res = bob.run_function_on_encrypted_input(alice.keyPair.p);
var result = alice.get_result_and_decrypt(c_res);
if(result != helper.test_function(alice.bloodType, bob.bloodType)){
failed = true;
System.out.println("RESULT: " + result + " : "+ alice.bloodType + " : " + bob.bloodType);
System.out.println("TEST: " + helper.test_function(alice.bloodType, bob.bloodType));
}
}
if (!failed) {
System.out.println("Everything was successful")
}
}
}
......@@ -13,7 +13,7 @@ public class d_he {
List<BigInteger> pk_list = new ArrayList<>();
for (int i = 0; i < 2000; i++) {
var qi = new BigInteger(5000000, rand);
var qi = new BigInteger(10000000, rand);
var ri = new BigInteger(60, rand);
var twoR = ri.multiply(BigInteger.TWO);
var yi = (p.multiply(qi)).add(twoR);
......