MCPcopy Index your code
hub / github.com/CDSecLab/MJXT / main

Method main

src/test/java/JXTpp.java:27–115  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

25 private static String K_aes = "8975924566f6e252";
26 private static String K_c = "6574b33984e7fb55";
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 = 2;//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("------------- JXT++ ---------------");
40 System.out.println("---------- JXT++ setup ------------");
41 long setup_start = System.nanoTime();
42 Setup_JXTpp[] table = new Setup_JXTpp[table_num];
43 Map<BigInteger, ArrayList<byte[]>> tset = new LinkedHashMap<>();
44 int[][] l_max = new int[table_num][join_column];
45 for (int i = 0; i < table_num; i++) {
46 table[i] = new Setup_JXTpp(i + 1, key_colnum, join_column, record_num, condition);
47 table[i].construct();
48 tset.putAll(table[i].getTset());
49 System.arraycopy(table[i].getL_max(), 0, l_max[i], 0, join_column);
50 }
51 long setup_end = System.nanoTime();
52 System.out.println("JXT++ setup time : " + (setup_end - setup_start)/Math.pow(10, 6) + " ms");
53
54 //Step 3 begin to search
55 System.out.println("---------- JXT++ search -----------");
56 for (int i = 0; i < table_num; i++) {//set the queried attribute-value pairs and join attributes
57 keyword[i] = "keyword0" + "table" + (i + 1) + "_keyword_0_0";
58 join_attr[i] = "join-attr0";
59 }
60
61 long search_all = 0;
62 for (int x = 0; x < 1000; x++) {//run 1000 times
63 long search_start = System.nanoTime();
64 //Step 3.1 compute the stag
65 BigInteger stag1 = new BigInteger(Hash.Get_SHA_256((K_token + keyword[0] + join_attr[0] + 1).getBytes(StandardCharsets.UTF_8)));
66 Server_JXTpp serverMMJXTpp = new Server_JXTpp(tset, table, stag1);
67 byte[] w_0 = Hash.Get_SHA_256((K_w + keyword[0]).getBytes(StandardCharsets.UTF_8));
68 Map<Integer, byte[]> map_cnt = new LinkedHashMap<>();
69 ArrayList<byte[][]> join_tokens = new ArrayList<>();
70 for (int i = 0; i < table_num; i++) {//Step 3.2 compute the joinTokens
71 byte[] w_i = Hash.Get_SHA_256((K_wp + keyword[i]).getBytes(StandardCharsets.UTF_8));
72 byte[] join_hash = Hash.Get_SHA_256((K_h + join_attr[i]).getBytes(StandardCharsets.UTF_8));
73 byte[][] join_token = new byte[l_max[i][0]][];
74 for (int j = 1; j <= l_max[i][0]; j++) {
75 byte[] cnt;
76 if (map_cnt.containsKey(j)){
77 cnt = map_cnt.get(j);
78 }else {
79 cnt = Hash.Get_SHA_256((K_c + j).getBytes(StandardCharsets.UTF_8));
80 map_cnt.put(j, cnt);
81 }
82 join_token[j - 1] = tool.Xor(tool.Xor(tool.Xor(w_0, w_i), join_hash), cnt);
83 }
84 join_tokens.add(join_token);

Callers

nothing calls this directly

Calls 8

Get_SHA_256Method · 0.95
searchMethod · 0.95
decryptMethod · 0.95
getL_maxMethod · 0.80
XorMethod · 0.80
addMethod · 0.80
constructMethod · 0.45
getTsetMethod · 0.45

Tested by

no test coverage detected