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

Method main

src/test/java/test_JXTp.java:26–98  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

24 private static String K_aes = "8975924566f6e252";
25
26 public static void main(String[] args) {
27 //Step 1 prepare the parameters
28 //the number of attributes which aren't the join attribute in the table.
29 int key_colnum = 9;
30 //the number join attributes in the table.
31 int join_column = 1;
32 int record_num = (int)Math.pow(2, 16);//the number of records of the table (65536 lines)
33 String condition = "";//used to choose different tables from dataset, e.g., "_14".
34
35 System.out.println("--------------------- JXT+ -----------------------");
36 //Step 2 begin to set up
37 Setup_JXTp table_1 = new Setup_JXTp(1, key_colnum, join_column, record_num, condition);
38 table_1.construct();
39 Map<BigInteger, ArrayList<byte[]>> tset = table_1.getTset();
40
41 Setup_JXTp table_2 = new Setup_JXTp(2, key_colnum, join_column, record_num, condition);
42 table_2.construct();
43 tset.putAll(table_2.getTset());
44 //Step 3 begin to search
45 for (int v = 0; v < 20; v++) {
46 String keyword1 = "keyword0" + "table1_keyword_" + v + "_0";
47 String keyword2 = "keyword0" + "table2_keyword_" + v + "_0";
48 System.out.println("--------- JXT+ search(table_keyword_" + v + "_0) ---------");
49 String join_attr1 = "join-attr0";
50 String join_attr2 = "join-attr0";
51 long search_all = 0;
52 for (int x = 0; x < 1000; x++) {
53 long search_start = System.nanoTime();
54 Server_JXTp serverMJXT = new Server_JXTp(tset, table_1.getF(),
55 table_1.getCset(), table_2.getF(), table_2.getCset());
56 //Step 3.1 compute the stag
57 BigInteger stag1 = new BigInteger(Hash.Get_SHA_256((K_token + keyword1 + join_attr1 + 1).getBytes(StandardCharsets.UTF_8)));
58 int cnt1 = serverMJXT.tset_table1_cnt(stag1);
59 byte[][] join_token1 = new byte[cnt1][];
60 byte[][] join_token2 = new byte[cnt1][];
61 byte[] w = Hash.Get_SHA_256((K_w + keyword1 + 0).getBytes(StandardCharsets.UTF_8));
62 byte[] y = Hash.Get_SHA_256((K_w + keyword2 + 0).getBytes(StandardCharsets.UTF_8));
63 byte[] join_hash1 = Hash.Get_SHA_256((K_h + join_attr1).getBytes(StandardCharsets.UTF_8));
64 byte[] join_hash2 = Hash.Get_SHA_256((K_h + join_attr2).getBytes(StandardCharsets.UTF_8));
65 //Step 3.2 compute the joinTokens
66 for (int i = 0; i < cnt1; i++) {
67 byte[] w_cnt = Hash.Get_SHA_256((K_w + keyword1 + (i + 1)).getBytes(StandardCharsets.UTF_8));
68 join_token1[i] = tool.Xor(tool.Xor(w, w_cnt), join_hash1);
69 join_token2[i] = tool.Xor(tool.Xor(y, w_cnt), join_hash2);
70 }
71 //Step 3.3 the server returns the satisfying results
72 ArrayList<ArrayList<byte[]>> res = serverMJXT.search(join_token1, join_token2);
73 byte[] k_dec1 = Hash.Get_SHA_256((K_aes + keyword1).getBytes());
74 byte[] k_dec2 = Hash.Get_SHA_256((K_aes + keyword2).getBytes());
75 //Step 3.4 decrypt the encrypted identifiers
76 for (int i = 0; i < res.size(); i++) {
77 if (i % 2 == 0){
78 ArrayList<byte[]> res_i = res.get(i);
79 for (int j = 0; j < res_i.size(); j++) {
80 AESUtil.decrypt(k_dec1, res_i.get(j));
81 }
82 }else {
83 ArrayList<byte[]> res_i = res.get(i);

Callers

nothing calls this directly

Calls 9

constructMethod · 0.95
getTsetMethod · 0.95
getFMethod · 0.95
getCsetMethod · 0.95
Get_SHA_256Method · 0.95
tset_table1_cntMethod · 0.95
searchMethod · 0.95
decryptMethod · 0.95
XorMethod · 0.80

Tested by

no test coverage detected