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
5c19f0c7
Commit
5c19f0c7
authored
Jan 17, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main/Analysis.cc the function needSalt(l)in 196,able to decrypt ASHE,wow!
parent
5a424dff
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
ASHE.cc
crypto/ASHE.cc
+17
-0
ASHE.hh
crypto/ASHE.hh
+4
-0
test_ASHE.cc
debug/test_ASHE.cc
+2
-2
Analysis.cc
main/Analysis.cc
+2
-2
No files found.
crypto/ASHE.cc
View file @
5c19f0c7
...
...
@@ -14,12 +14,29 @@ std::pair<long,uint64_t> RAW_ASHE::encrypt(unsigned int plaintext){
return
std
::
make_pair
(
ciphertext
,
IV
);
}
std
::
pair
<
long
,
uint64_t
>
RAW_ASHE
::
encrypt
(
unsigned
int
plaintext
,
uint64_t
inIV
){
uint64_t
i
=
Fi
(
inIV
)
%
RAW_ASHE_MAX
,
i_1
=
Fi_1
(
inIV
)
%
RAW_ASHE_MAX
;
long
res
=
(
long
)
i_1
-
(
long
)
i
;
ciphertext
=
((
long
)
plaintext
+
res
)
%
RAW_ASHE_MAX
;
return
std
::
make_pair
(
ciphertext
,
inIV
);
}
unsigned
int
RAW_ASHE
::
decrypt
(
long
ciphertext
){
uint64_t
i
=
Fi
(
IV
)
%
RAW_ASHE_MAX
,
i_1
=
Fi_1
(
IV
)
%
RAW_ASHE_MAX
;
long
res
=
(
long
)
i
-
(
long
)
i_1
;
return
(
ciphertext
+
res
)
%
RAW_ASHE_MAX
;
}
unsigned
int
RAW_ASHE
::
decrypt
(
long
ciphertext
,
uint64_t
inIV
){
uint64_t
i
=
Fi
(
inIV
)
%
RAW_ASHE_MAX
,
i_1
=
Fi_1
(
inIV
)
%
RAW_ASHE_MAX
;
long
res
=
(
long
)
i
-
(
long
)
i_1
;
return
(
ciphertext
+
res
)
%
RAW_ASHE_MAX
;
}
std
::
pair
<
long
,
std
::
vector
<
uint64_t
>>
RAW_ASHE
::
sum
(
std
::
vector
<
RAW_ASHE
>
input
){
long
res
=
0
;
std
::
vector
<
uint64_t
>
ivs
;
...
...
crypto/ASHE.hh
View file @
5c19f0c7
...
...
@@ -16,7 +16,11 @@ public:
std
::
pair
<
long
,
uint64_t
>
encrypt
(
unsigned
int
plaintext
);
std
::
pair
<
long
,
uint64_t
>
encrypt
(
unsigned
int
plaintext
,
uint64_t
inIv
);
unsigned
int
decrypt
(
long
ciphertext
);
unsigned
int
decrypt
(
long
ciphertext
,
uint64_t
inIv
);
uint64_t
get_IV
(){
return
IV
;};
static
uint64_t
Fi
(
uint64_t
IV
){
return
bf
.
encrypt
(
IV
)
%
100000
;}
...
...
debug/test_ASHE.cc
View file @
5c19f0c7
...
...
@@ -12,8 +12,8 @@ int main(){
uint64_t
IV
=
randomValue
();
if
(
IV
==
0
)
IV
=
1
;
ass
.
push_back
(
RAW_ASHE
(
IV
));
ass
.
back
().
encrypt
(
seed
);
unsigned
int
res
=
ass
.
back
().
decrypt
(
ass
.
back
().
get_ciphertext
());
ass
.
back
().
encrypt
(
seed
,
IV
);
unsigned
int
res
=
ass
.
back
().
decrypt
(
ass
.
back
().
get_ciphertext
()
,
IV
);
if
(
res
==
seed
)
std
::
cout
<<
"pass"
<<
std
::
endl
;
else
std
::
cout
<<
"not pass!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
<<
std
::
endl
;
seed
++
;
...
...
main/Analysis.cc
View file @
5c19f0c7
...
...
@@ -192,11 +192,11 @@ OLK EncSet::extract_singleton() const
return
OLK
(
it
->
first
,
it
->
second
.
first
,
it
->
second
.
second
);
}
// needsSaltz must have consistent semantics.
// needsSaltz must have consistent semantics.
shaoyiwen
static
bool
needsSalt
(
SECLEVEL
l
)
{
return
l
==
SECLEVEL
::
RND
;
return
l
==
SECLEVEL
::
RND
||
l
==
SECLEVEL
::
ASHE
;
}
bool
...
...
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