Skip to content

Commit

Permalink
Forgot to add bit check on original alice. Veugan and OG DGK should w…
Browse files Browse the repository at this point in the history
…ork. will add equality test cases shortly and hope to finish a finalized Joye approach soon
  • Loading branch information
Andrew Quijano committed Mar 3, 2024
1 parent d5b7f4d commit e7955c5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/main/java/security/socialistmillionaire/alice.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@ public BigInteger division(BigInteger x, long d)
z = PaillierCipher.add_plaintext(x, r, paillier_public);
//N = paillier_public.n;
}
toBob.writeObject(z);
toBob.flush();

writeObject(z);

// Step 2: Executed by Bob

// Step 3: Compute secure comparison Protocol
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/security/socialistmillionaire/bob.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ else if (temp.equals(BigInteger.ZERO)) {
boolean foundZero = false;
for (BigInteger C_i : C) {
long value = DGKOperations.decrypt(C_i, dgk_private);
foundZero |= (value == 0L);
if (value == 0) {
foundZero = true;
}
}

// Perform constant-time comparison to update deltaB
if (foundZero) {
deltaB = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public boolean Protocol2()
// Step 4: Run Modified DGK Comparison Protocol
// true --> run Modified protocol 3

if(fromAlice.readBoolean()) {
if(readBoolean()) {
if(Modified_Protocol3(beta, z)) {
System.out.println("Modified Protocol 3 selected");
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/test/test_alice.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void test_sorting(boolean dgk_mode)
}
// Use assert to sort array
Arrays.sort(toSort);
System.out.println("Checking Arrays" + Arrays.toString(toSort));
for (int i = 0; i < min.length; i++) {
assertEquals(toSort[i], min[i]);
}
Expand Down

0 comments on commit e7955c5

Please sign in to comment.