Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
cbb7597c
Commit
cbb7597c
authored
Jan 30, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to test token size in SWP
parent
f0b97665
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
3 deletions
+40
-3
rand_str.cc
debug/rand_str.cc
+1
-0
test_layer_SWP.cc
debug/test_layer_SWP.cc
+34
-2
CryptoHandlers.cc
main/CryptoHandlers.cc
+2
-1
CryptoHandlers.hh
main/CryptoHandlers.hh
+3
-0
No files found.
debug/rand_str.cc
View file @
cbb7597c
...
@@ -14,6 +14,7 @@ uint64_t cur_usec() {
...
@@ -14,6 +14,7 @@ uint64_t cur_usec() {
}
}
using
namespace
std
;
using
namespace
std
;
static
static
std
::
string
std
::
string
getpRandomName
(
int
out_length
=
10
){
getpRandomName
(
int
out_length
=
10
){
...
...
debug/test_layer_SWP.cc
View file @
cbb7597c
...
@@ -17,7 +17,14 @@
...
@@ -17,7 +17,14 @@
#include "util/timer.hh"
#include "util/timer.hh"
#include "util/log.hh"
#include "util/log.hh"
#include "util/onions.hh"
#include "util/onions.hh"
#include <sys/time.h>
static
uint64_t
cur_usec
()
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
((
uint64_t
)
tv
.
tv_sec
)
*
1000000
+
tv
.
tv_usec
;
}
using
std
::
cout
;
using
std
::
cout
;
using
std
::
cin
;
using
std
::
cin
;
using
std
::
endl
;
using
std
::
endl
;
...
@@ -32,6 +39,28 @@ static std::map<std::string, WrapperState*> clients;
...
@@ -32,6 +39,28 @@ static std::map<std::string, WrapperState*> clients;
Connect
*
globalConn
;
Connect
*
globalConn
;
static
std
::
string
getpRandomName
(
int
out_length
=
10
){
static
const
char
valids
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
;
char
output
[
out_length
+
1
];
// std::function<bool()> wrap_srand =[](){srand(time(NULL)); return true;};
std
::
function
<
bool
()
>
wrap_srand
=
[](){
srand
(
cur_usec
());
return
true
;};
std
::
function
<
void
(
bool
)
>
do_nothing
=
[]
(
bool
b
)
{
return
;};
static
bool
danger_will_robinson
=
wrap_srand
();
do_nothing
(
danger_will_robinson
);
for
(
int
i
=
0
;
i
<
out_length
;
++
i
)
{
output
[
i
]
=
valids
[
rand
()
%
strlen
(
valids
)];
}
output
[
out_length
]
=
0
;
return
std
::
string
(
output
);
}
/*for each field, convert the format to FieldMeta_Wrapper*/
/*for each field, convert the format to FieldMeta_Wrapper*/
...
@@ -117,7 +146,9 @@ main(int argc,char**argv) {
...
@@ -117,7 +146,9 @@ main(int argc,char**argv) {
return
0
;
return
0
;
}
}
std
::
string
input
(
length
,
'a'
);
std
::
string
input
=
getpRandomName
(
length
);
//(length,'a');
auto
res
=
tokenize
(
input
);
Item
*
plain
=
getItemString
(
input
);
Item
*
plain
=
getItemString
(
input
);
...
@@ -129,7 +160,8 @@ main(int argc,char**argv) {
...
@@ -129,7 +160,8 @@ main(int argc,char**argv) {
}
}
std
::
cout
<<
"ENC_OPE_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"ENC_OPE_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
"##"
<<
"plainlen: "
<<
plain
->
str_value
.
length
()
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
"##"
<<
"plainlen: "
<<
plain
->
str_value
.
length
()
<<
"tokennumber: "
<<
res
->
size
()
<<
std
::
endl
;
(
void
)
enc
;
(
void
)
enc
;
return
0
;
return
0
;
}
}
...
...
main/CryptoHandlers.cc
View file @
cbb7597c
...
@@ -1437,7 +1437,8 @@ token(const std::string &key, const std::string &word)
...
@@ -1437,7 +1437,8 @@ token(const std::string &key, const std::string &word)
//currently, we split by whitespaces
//currently, we split by whitespaces
// only consider words at least 3 chars in len
// only consider words at least 3 chars in len
// discard not unique objects
// discard not unique objects
static
std
::
list
<
std
::
string
>
*
std
::
list
<
std
::
string
>
*
tokenize
(
const
std
::
string
&
text
)
tokenize
(
const
std
::
string
&
text
)
{
{
std
::
list
<
std
::
string
>
tokens
=
split
(
text
,
" ,;:."
);
std
::
list
<
std
::
string
>
tokens
=
split
(
text
,
" ,;:."
);
...
...
main/CryptoHandlers.hh
View file @
cbb7597c
...
@@ -445,3 +445,6 @@ private:
...
@@ -445,3 +445,6 @@ private:
};
};
std
::
list
<
std
::
string
>
*
tokenize
(
const
std
::
string
&
text
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment