Skip to content

Commit

Permalink
Improve docs slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
fkettelhoit committed Jul 25, 2024
1 parent c9319c8 commit 99970d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion language_tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ for joined in join(rows1, rows2) {
```
Garble automatically joins the arrays in a for-each-join loop using a [bitonic sorting network](https://en.wikipedia.org/wiki/Bitonic_sorter), more concretely implementing the paper [Private Set Intersection:
Are Garbled Circuits Better than Custom Protocols?](https://www.ndss-symposium.org/wp-content/uploads/2017/09/06_4.pdf), which has a circuit complexity of `(m + n) * log(m + n)` instead of `m * n` which would result from joining the arrays using nested loops. **The arrays that are joined in the loop must be sorted**, otherwise elements might be discarded or invalid data returned.
Are Garbled Circuits Better than Custom Protocols?](https://www.ndss-symposium.org/wp-content/uploads/2017/09/06_4.pdf) without the shuffle step, which has a circuit complexity of `(m + n) * log(m + n)` instead of `m * n` which would result from joining the arrays using nested loops. **The arrays that are joined in the loop must be sorted**, otherwise elements might be discarded or invalid data returned.
For-each-join loops always join two arrays based on the first field. If you would like to compare more than one field for equality, the easiest way is to transform the sorted array so that the relevant fields are grouped together in a tuple and thus form the first field. Such a transformation will be completely optimized away by the Garble compiler, such as in the following example, which groups together the first two fields, compiled to a circuit with 0 gates:
Expand Down

0 comments on commit 99970d2

Please sign in to comment.