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
8e9efedf
Commit
8e9efedf
authored
Apr 03, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test_crypto
parent
a2673803
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
1 deletion
+62
-1
Makefile
Makefile
+5
-0
test_OPE.cc
debug/test_OPE.cc
+0
-1
Makefrag
test_crypto/Makefrag
+7
-0
test_ope.cc
test_crypto/test_ope.cc
+5
-0
test_ope_int.cc
test_crypto/test_ope_int.cc
+45
-0
No files found.
Makefile
View file @
8e9efedf
...
...
@@ -108,6 +108,10 @@ mtl/tools/%:$(OBJDIR)/tools/%.o $(OBJDIR)/libredisbio.so $(OBJDIR)/libwrapper.so
@
mkdir
-p
$
(
@D
)
$(CXX)
-g
-o
$@
$<
$(CXXFLAGS)
$(LDFLAGS)
-L
/
$(MYBUILD)
/libmysqld
-lmysqld
-laio
-lz
-ldl
-lm
-lcrypt
-lpthread
-lwrapper
-lcryptdb
-ledbcrypto
-ledbutil
-ledbparser
-lntl
-lcrypto
-lredisbio
mtl/test_crypto_exe/%
:
$(OBJDIR)/test_crypto/%.o
@
mkdir
-p
$
(
@D
)
$(CXX)
-g
-o
$@
$^
$(CXXFLAGS)
$(LDFLAGS)
-L
/
$(MYBUILD)
/libmysqld
-lmysqld
-laio
-lz
-ldl
-lm
-lcrypt
-lpthread
-ledbutil
-lntl
-ledbcrypto
-lcrypto
include
crypto/Makefrag
include
parser/Makefrag
...
...
@@ -125,6 +129,7 @@ include test_parser_helper/Makefrag
include
redisbio/Makefrag
include
test_redisbio/Makefrag
include
tools/Makefrag
include
test_crypto/Makefrag
$(OBJDIR)/.deps
:
$(foreach dir
,
$(OBJDIRS)
,
$(wildcard $(OBJDIR)/$(dir)/*.d))
@
mkdir
-p
$
(
@D
)
...
...
debug/test_OPE.cc
View file @
8e9efedf
...
...
@@ -3,7 +3,6 @@
#include <iostream>
#include <memory>
#include <iomanip>
#include <crypto/padding.hh>
#include <crypto/prng.hh>
#include <crypto/BasicCrypto.hh>
...
...
test_crypto/Makefrag
0 → 100644
View file @
8e9efedf
OBJDIRS += test_crypto
##note that xx=*.cc will not expand. wildcard *.cc will include files from other directories.
##%.o will include testall
TESTALL_OBJS := $(patsubst %.cc,$(OBJDIR)/%.o,$(wildcard test_crypto/*.cc))
TESTALL_EXES := $(patsubst test_crypto/%.cc,mtl/test_crypto_exe/%,$(wildcard test_crypto/*.cc))
all: $(TESTALL_OBJS) $(TESTALL_EXES)
test_crypto/test_ope.cc
0 → 100644
View file @
8e9efedf
int
main
()
{
return
0
;
}
test_crypto/test_ope_int.cc
0 → 100644
View file @
8e9efedf
#include <string>
#include <map>
#include <iostream>
#include <memory>
#include <iomanip>
#include <crypto/padding.hh>
#include <crypto/prng.hh>
#include <crypto/BasicCrypto.hh>
#include <crypto/blowfish.hh>
#include <crypto/arc4.hh>
#include <crypto/cbc.hh>
#include <crypto/ope.hh>
#include <util/util.hh>
#include <NTL/ZZ.h>
using
namespace
NTL
;
static
std
::
string
prng_expand
(
const
std
::
string
&
seed_key
,
uint
key_bytes
){
streamrng
<
arc4
>
prng
(
seed_key
);
return
prng
.
rand_string
(
key_bytes
);
}
static
void
test_OPEint
()
{
std
::
string
key
=
"12345798797"
;
std
::
string
rawkey
=
prng_expand
(
key
,
16
);
const
size_t
plain_size
=
4
;
const
size_t
ciph_size
=
8
;
OPE
ope
(
rawkey
,
8
*
plain_size
,
8
*
ciph_size
);
uint64_t
plaintext
=
123456789
;
NTL
::
ZZ
enc
,
dec
;
uint64_t
enc64
,
dec64
;
enc
=
ope
.
encrypt
(
ZZFromUint64
(
plaintext
));
enc64
=
uint64FromZZ
(
enc
);
dec
=
ope
.
decrypt
(
ZZFromUint64
(
enc64
));
dec64
=
uint64FromZZ
(
dec
);
std
::
cout
<<
"enc: "
<<
enc
<<
"dec: "
<<
dec
<<
std
::
endl
;
std
::
cout
<<
"enc64: "
<<
enc64
<<
"dec64:"
<<
dec64
<<
std
::
endl
;
}
int
main
(){
test_OPEint
();
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