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
7f05f8a6
Commit
7f05f8a6
authored
Jan 30, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to finish test_layer
parent
cbb7597c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
70 deletions
+96
-70
test_layer_DET_str.cc
debug/test_layer_DET_str.cc
+25
-25
test_layer_OPE_str.cc
debug/test_layer_OPE_str.cc
+16
-11
test_layer_RND_str.cc
debug/test_layer_RND_str.cc
+29
-18
test_layer_SWP.cc
debug/test_layer_SWP.cc
+26
-16
No files found.
debug/test_layer_DET_str.cc
View file @
7f05f8a6
...
...
@@ -98,6 +98,27 @@ Create_field* getUnsignedIntField(){
*/
static
void
control
(
DET_str
*
ds
,
Item
*
plain
,
int
num_of_tests
,
int
length
)
{
Item
*
enc
=
NULL
;
Item
*
dec
=
NULL
;
std
::
cout
<<
"length: "
<<
length
<<
std
::
endl
;
std
::
cout
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
ds
->
encrypt
(
*
plain
,
0u
);
}
std
::
cout
<<
"ENC_DET_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
dec
=
ds
->
decrypt
(
*
enc
,
0u
);
}
std
::
cout
<<
"DEC_DET_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
std
::
endl
;
std
::
cout
<<
"declen: "
<<
dec
->
str_value
.
length
()
<<
std
::
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
init
();
...
...
@@ -116,32 +137,11 @@ main(int argc,char**argv) {
std
::
cout
<<
"num_of_tests:length"
<<
std
::
endl
;
return
0
;
}
std
::
string
input
(
length
,
'a'
);
Item
*
plain
=
getItemString
(
input
);
Item
*
enc
=
NULL
;
Item
*
dec
=
NULL
;
std
::
cout
<<
"length: "
<<
length
<<
" ## "
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
ds
->
encrypt
(
*
plain
,
0u
);
}
std
::
cout
<<
"ENC_DET_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
dec
=
ds
->
decrypt
(
*
enc
,
0u
);
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
(
length
*
i
,
'a'
)
;
Item
*
plain
=
getItemString
(
input
)
;
control
(
ds
,
plain
,
num_of_tests
,
length
*
i
)
;
}
std
::
cout
<<
"DEC_DET_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
"##"
<<
"declen: "
<<
dec
->
str_value
.
length
()
<<
std
::
endl
;
(
void
)
dec
;
return
0
;
}
...
...
debug/test_layer_OPE_str.cc
View file @
7f05f8a6
...
...
@@ -97,7 +97,18 @@ Create_field* getUnsignedIntField(){
}
*/
static
void
control
(
OPE_str
*
ds
,
Item
*
plain
,
int
num_of_tests
,
int
length
)
{
Item
*
enc
=
NULL
;
std
::
cout
<<
"length: "
<<
length
<<
std
::
endl
;
std
::
cout
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
ds
->
encrypt
(
*
plain
,
0u
);
}
std
::
cout
<<
"ENC_OPE_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
std
::
endl
;
}
int
...
...
@@ -119,18 +130,12 @@ main(int argc,char** argv) {
return
0
;
}
std
::
string
input
(
length
,
'a'
);
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
(
length
*
i
,
'a'
);
Item
*
plain
=
getItemString
(
input
);
std
::
cout
<<
"length: "
<<
length
<<
" ## "
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
Item
*
enc
=
NULL
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
op
->
encrypt
(
*
plain
,
0u
);
control
(
op
,
plain
,
num_of_tests
,
length
*
i
);
}
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
;
(
void
)
enc
;
return
0
;
}
...
...
debug/test_layer_RND_str.cc
View file @
7f05f8a6
...
...
@@ -98,6 +98,30 @@ Create_field* getUnsignedIntField(){
*/
static
void
control
(
RND_str
*
ds
,
Item
*
plain
,
int
num_of_tests
,
int
length
)
{
Item
*
enc
=
NULL
;
Item
*
dec
=
NULL
;
std
::
cout
<<
"length: "
<<
length
<<
std
::
endl
;
std
::
cout
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
ds
->
encrypt
(
*
plain
,
0u
);
}
std
::
cout
<<
"ENC_RND_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
dec
=
ds
->
decrypt
(
*
enc
,
0u
);
}
std
::
cout
<<
"DEC_RND_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
std
::
endl
;
std
::
cout
<<
"declen: "
<<
dec
->
str_value
.
length
()
<<
std
::
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
init
();
...
...
@@ -117,26 +141,13 @@ main(int argc,char**argv) {
return
0
;
}
std
::
string
input
(
length
,
'a'
);
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
(
length
*
i
,
'a'
);
Item
*
plain
=
getItemString
(
input
);
Item
*
enc
=
NULL
;
Item
*
dec
=
NULL
;
std
::
cout
<<
"length: "
<<
length
<<
" ## "
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
){
enc
=
rs
->
encrypt
(
*
plain
,
0u
);
}
std
::
cout
<<
"ENC_RND_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
){
dec
=
rs
->
decrypt
(
*
enc
,
0u
);
control
(
rs
,
plain
,
num_of_tests
,
length
*
i
);
}
std
::
cout
<<
"DEC_RND_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
"##"
<<
"declen: "
<<
dec
->
str_value
.
length
()
<<
std
::
endl
;
(
void
)
dec
;
(
void
)
enc
;
return
0
;
}
...
...
debug/test_layer_SWP.cc
View file @
7f05f8a6
...
...
@@ -127,6 +127,27 @@ Create_field* getUnsignedIntField(){
*/
static
void
control
(
Search
*
sw
,
Item
*
plain
,
int
num_of_tests
,
int
length
,
int
token_size
)
{
Item
*
enc
=
NULL
;
std
::
cout
<<
"length: "
<<
length
<<
std
::
endl
;
std
::
cout
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
sw
->
encrypt
(
*
plain
,
0u
);
}
std
::
cout
<<
"ENC_SWP_STR_IN_us: "
<<
t
.
lap
()
*
1.0
/
num_of_tests
<<
std
::
endl
;
std
::
cout
<<
"tokennumber: "
<<
token_size
<<
std
::
endl
;
std
::
cout
<<
"enclen: "
<<
enc
->
str_value
.
length
()
<<
std
::
endl
;
std
::
cout
<<
"plainlen: "
<<
plain
->
str_value
.
length
()
<<
std
::
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
init
();
...
...
@@ -146,23 +167,12 @@ main(int argc,char**argv) {
return
0
;
}
std
::
string
input
=
getpRandomName
(
length
);
//(length,'a');
auto
res
=
tokenize
(
input
);
for
(
int
i
=
1
;
i
<=
100
;
i
++
)
{
std
::
string
input
=
getpRandomName
(
length
*
i
);
Item
*
plain
=
getItemString
(
input
);
std
::
cout
<<
"length: "
<<
length
<<
" ## "
<<
"num_of_tests: "
<<
num_of_tests
<<
std
::
endl
;
timer
t
;
Item
*
enc
=
NULL
;
for
(
int
i
=
0
;
i
<
num_of_tests
;
i
++
)
{
enc
=
sw
->
encrypt
(
*
plain
,
0u
);
auto
res
=
tokenize
(
input
);
control
(
sw
,
plain
,
num_of_tests
,
length
*
i
,
res
->
size
());
}
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
()
<<
"tokennumber: "
<<
res
->
size
()
<<
std
::
endl
;
(
void
)
enc
;
return
0
;
}
...
...
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