Created with IntelliJ IDEA. @Author: 杜凯 @Date: 2023/09/27/19:54 @Description: the server's process about the search algorithm of JXT called MJXT+, where MJXT+ is a Join-query scheme supporting the multi-tables (three or more) search by a trivial method which leak SRP(sub-query pattern).
| 17 | * supporting the multi-tables (three or more) search by a trivial method which leak SRP(sub-query pattern). |
| 18 | */ |
| 19 | public class Server_MJXTp { |
| 20 | private Map<BigInteger, ArrayList<byte[]>> tset; |
| 21 | private Bloom[] f; |
| 22 | private Map<Long, ArrayList<byte[]>>[] cset; |
| 23 | private BigInteger stag1; |
| 24 | |
| 25 | public Server_MJXTp(Map<BigInteger, ArrayList<byte[]>> tset, Setup_JXTp[] table) { |
| 26 | int table_num = table.length; |
| 27 | this.tset = tset; |
| 28 | f = new Bloom[table_num]; |
| 29 | cset = new Map[table_num]; |
| 30 | for (int i = 0; i < table_num; i++) { |
| 31 | f[i] = table[i].getF(); |
| 32 | cset[i] = table[i].getCset(); |
| 33 | } |
| 34 | } |
| 35 | /** |
| 36 | * Get the number of the first table's TSet entries |
| 37 | * @param stag1 the first table's stag |
| 38 | * @return the number of the matching TSet entries |
| 39 | */ |
| 40 | public int tset_table1_cnt(BigInteger stag1) { |
| 41 | this.stag1 = stag1; |
| 42 | return tset.get(stag1).size(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * the server operations of the search algorithm for MJXT+ |
| 47 | * @param join_tokens the jointokens for MJXT+ |
| 48 | * @return the matching result |
| 49 | */ |
| 50 | public ArrayList<ArrayList<byte[]>> search(ArrayList<byte[][]> join_tokens) { |
| 51 | ArrayList<ArrayList<byte[]>> res = new ArrayList<>(); |
| 52 | ArrayList<byte[]> token1_tset = tset.get(stag1); |
| 53 | for (int i = 0; i < token1_tset.size(); i++) { |
| 54 | byte[] token1 = token1_tset.get(i); |
| 55 | long[] xtoken_long = new long[join_tokens.size()]; |
| 56 | for (int j = 1; j < join_tokens.size(); j++) { |
| 57 | byte[] xtoken = tool.Xor(token1, join_tokens.get(j)[i]); |
| 58 | xtoken_long[j] = tool.bytesToLong(xtoken); |
| 59 | if (!f[j].mayContain(xtoken_long[j])) break; |
| 60 | if (j == join_tokens.size() - 1) { |
| 61 | xtoken_long[0] = tool.bytesToLong(tool.Xor(token1, join_tokens.get(0)[i])); |
| 62 | for (int k = 0; k < xtoken_long.length; k++) { |
| 63 | ArrayList<byte[]> ct = cset[k].get(xtoken_long[k]); |
| 64 | res.add(ct); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | return res; |
| 70 | } |
| 71 | } |
nothing calls this directly
no outgoing calls
no test coverage detected