(String[] args)
| 25 | private static String K_aes = "8975924566f6e252"; |
| 26 | |
| 27 | public static void main(String[] args) { |
| 28 | //Step 1 prepare the parameters |
| 29 | //the number of attributes which aren't the join attribute in the table. |
| 30 | int key_colnum = 9;//the values{5, 6, 7, 8, 9} for our dataset |
| 31 | //the number join attributes in the table. |
| 32 | int join_column = 1;//the values{5, 4, 3, 2, 1} for our dataset |
| 33 | int record_num = (int)Math.pow(2, 16);//the number of records of the table (65536 lines) |
| 34 | int table_num = 3;//the number of the queried tables |
| 35 | String condition = "";//used to choose different tables from dataset, e.g., "_4". |
| 36 | String[] keyword = new String[table_num]; |
| 37 | String[] join_attr = new String[table_num]; |
| 38 | //Step 2 begin to set up |
| 39 | System.out.println("------------- MJXT ---------------"); |
| 40 | System.out.println("----------- MJXT setup -----------"); |
| 41 | long setup_start = System.nanoTime(); |
| 42 | Setup_JXT[] table = new Setup_JXT[table_num]; |
| 43 | Map<BigInteger, ArrayList<tuple>> tset = new LinkedHashMap<>(); |
| 44 | for (int i = 0; i < table_num; i++) { |
| 45 | table[i] = new Setup_JXT(i + 1, key_colnum, join_column, record_num, condition); |
| 46 | table[i].construct(); |
| 47 | tset.putAll(table[i].getTset()); |
| 48 | } |
| 49 | long setup_end = System.nanoTime(); |
| 50 | System.out.println("MJXT setup time : " + (setup_end - setup_start)/Math.pow(10, 6) + " ms"); |
| 51 | |
| 52 | //Step 3 begin to search |
| 53 | System.out.println("------------ MJXT search ------------"); |
| 54 | for (int i = 0; i < table_num; i++) {//set the queried attribute-value pairs and join attributes |
| 55 | keyword[i] = "keyword0" + "table" + (i + 1) + "_keyword_0_0"; |
| 56 | join_attr[i] = "join-attr0"; |
| 57 | } |
| 58 | long search_all = 0; |
| 59 | for (int x = 0; x < 1000; x++) {//run 1000 times |
| 60 | long search_start = System.nanoTime(); |
| 61 | Server_MJXT serverMJXT = new Server_MJXT(tset, table); |
| 62 | //Step 3.1 compute the stags |
| 63 | BigInteger[] stag = new BigInteger[table_num]; |
| 64 | for (int i = 0; i < table_num; i++) { |
| 65 | stag[i] = new BigInteger(Hash.Get_SHA_256((K_token + keyword[i] + (i + 1)).getBytes(StandardCharsets.UTF_8))); |
| 66 | } |
| 67 | int[] cnt = serverMJXT.tset_table_cnt(stag); |
| 68 | byte[][] keyword_0 = new byte[table_num][]; |
| 69 | keyword_0[0] = Hash.Get_SHA_256((K_h2 + keyword[0] + 0).getBytes(StandardCharsets.UTF_8));//第一张表为驱动表 |
| 70 | for (int i = 1; i < table_num; i++) { |
| 71 | keyword_0[i] = Hash.Get_SHA_256((K_h1 + keyword[i] + 0).getBytes(StandardCharsets.UTF_8)); |
| 72 | } |
| 73 | //Step 3.2 compute the joinTokens |
| 74 | ArrayList<byte[][]> join_tokens1 = new ArrayList<>(); |
| 75 | for (int i = 1; i < table_num; i++) { |
| 76 | byte[][] join_token = new byte[cnt[0]][]; |
| 77 | for (int j = 0; j < cnt[0]; j++) { |
| 78 | join_token[j] = tool.Xor(Hash.Get_SHA_256((K_h2 + keyword[0] + (j + 1)).getBytes(StandardCharsets.UTF_8)), keyword_0[i]); |
| 79 | } |
| 80 | join_tokens1.add(join_token); |
| 81 | } |
| 82 | ArrayList<byte[][]> join_tokens2 = new ArrayList<>(); |
| 83 | for (int i = 1; i < table_num; i++) { |
| 84 | byte[][] join_token = new byte[cnt[i]][]; |
nothing calls this directly
no test coverage detected