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
2e42ccbf
Commit
2e42ccbf
authored
Feb 26, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish testing pailliar
parent
729da60d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
0 deletions
+59
-0
.gitignore
.gitignore
+1
-0
.paillier.cc.swp
crypto/.paillier.cc.swp
+0
-0
test_pailliar.cc
debug/test_pailliar.cc
+58
-0
token.cc
token.cc
+0
-0
No files found.
.gitignore
View file @
2e42ccbf
...
@@ -32,3 +32,4 @@ packages/tls/mysqlWrapper/main
...
@@ -32,3 +32,4 @@ packages/tls/mysqlWrapper/main
*pipelinefile*
*pipelinefile*
*.conf
*.conf
input/sql
input/sql
token.cc
crypto/.paillier.cc.swp
deleted
100644 → 0
View file @
729da60d
File deleted
debug/test_pailliar.cc
0 → 100644
View file @
2e42ccbf
#include "parser/sql_utils.hh"
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include "main/CryptoHandlers.hh"
#include "crypto/arc4.hh"
#include "wrapper/reuse.hh"
#include "wrapper/common.hh"
#include "wrapper/insert_lib.hh"
#include "util/constants.hh"
#include "util/timer.hh"
#include "util/log.hh"
#include "util/util.hh"
#include <NTL/ZZ.h>
using
std
::
cout
;
using
std
::
cin
;
using
std
::
endl
;
using
std
::
vector
;
using
std
::
string
;
using
std
::
to_string
;
using
namespace
NTL
;
int
main
(
int
argc
,
char
**
argv
)
{
Paillier_priv
*
sk
;
uint
nbits
=
1024
;
const
std
::
unique_ptr
<
streamrng
<
arc4
>>
prng
(
new
streamrng
<
arc4
>
(
"123456"
));
sk
=
new
Paillier_priv
(
Paillier_priv
::
keygen
(
prng
.
get
(),
nbits
));
NTL
::
ZZ
k
=
sk
->
hompubkey
();
ZZ
pt0
=
NTL
::
to_ZZ
(
1
);
ZZ
pt1
=
NTL
::
to_ZZ
(
2
);
const
ZZ
enc0
=
sk
->
encrypt
(
pt0
);
const
ZZ
dec0
=
sk
->
decrypt
(
enc0
);
const
ZZ
enc1
=
sk
->
encrypt
(
pt1
);
const
ZZ
dec1
=
sk
->
decrypt
(
enc1
);
assert
(
pt0
==
dec0
);
assert
(
pt1
==
dec1
);
assert
((
pt0
+
pt1
)
==
sk
->
decrypt
(
sk
->
add
(
enc0
,
enc1
)));
std
::
cout
<<
sk
->
decrypt
(
MulMod
(
enc0
,
enc1
,
k
))
<<
std
::
endl
;
UNUSED
(
sk
);
UNUSED
(
k
);
return
0
;
}
token.cc
deleted
100644 → 0
View file @
729da60d
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