Skip to content
GitLab
菜单
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
Heng Wang
Eurocrypto18-AggregateSignatures
提交
53066018
提交
53066018
编辑于
6月 23, 2020
作者:
Heng Wang
浏览文件
Test Modify
上级
90a6c72a
变更
1
Hide whitespace changes
Inline
Side-by-side
BasicSAS.cpp
浏览文件 @
53066018
...
...
@@ -71,9 +71,7 @@ BasicSAS::aggregateVerify(unsigned t, const vector<PK>& pks, const vector<string
if
(
pks
[
i
]
==
pks
[
j
])
return
false
;
}
}
cout
<<
"Final Steps."
<<
endl
;
Integer
e_t
{
this
->
publicParameters
.
hashToPrime
(
t
)};
cout
<<
"e_t "
<<
e_t
<<
endl
;
Integer
left
{
ma
.
Exponentiate
(
aggSignatures
,
e_t
)};
Integer
right
{
Integer
::
One
()};
for
(
int
i
=
0
;
i
<
pks
.
size
();
++
i
)
{
...
...
@@ -83,8 +81,6 @@ BasicSAS::aggregateVerify(unsigned t, const vector<PK>& pks, const vector<string
right
=
ma
.
Multiply
(
right
,
ma
.
Exponentiate
(
pks
[
i
][
j
],
msg_frags
[
j
-
1
]));
}
}
cout
<<
"Left: "
<<
left
<<
endl
;
cout
<<
"Right: "
<<
right
<<
endl
;
return
left
==
right
;
}
...
...
@@ -114,28 +110,27 @@ BasicSAS::dismantleMsg(const string& msg)
int
main
(
int
argc
,
char
**
argv
)
{
const
unsigned
lambda
=
256
;
const
unsigned
timePeriod
=
10
;
const
unsigned
lambda
=
128
;
const
unsigned
timePeriod
=
10
00
;
Setup
pp
{
lambda
,
timePeriod
};
BasicSAS
sasOne
{
pp
},
sasTwo
{
pp
},
sasThree
{
pp
};
cout
<<
"Setup Done."
<<
endl
;
sasOne
.
Keygen
();
sasTwo
.
Keygen
();
sasThree
.
Keygen
();
string
msgOne
{
"Hello, World."
};
string
msgTwo
{
"C++"
};
string
msgThree
{
"Python"
};
string
msgFake
{
"Hello."
};
const
unsigned
time
=
2
;
const
unsigned
timeFake
=
3
;
Integer
sOne
{
sasOne
.
sign
(
msgOne
,
time
)},
sTwo
{
sasTwo
.
sign
(
msgTwo
,
time
)},
sThree
{
sasThree
.
sign
(
msgThree
,
time
)};
Integer
aggS
{
sasOne
.
aggregate
(
time
,
{
sOne
,
sTwo
,
sThree
})};
cout
<<
sasOne
.
verify
(
msgOne
,
time
,
sOne
)
<<
endl
;
cout
<<
sasTwo
.
verify
(
msgTwo
,
time
,
sTwo
)
<<
endl
;
cout
<<
sasThree
.
verify
(
msgThree
,
time
,
sThree
)
<<
endl
;
cout
<<
aggS
<<
endl
;
cout
<<
sasTwo
.
aggregateVerify
(
time
,
{
sasOne
.
publicKey
(),
sasTwo
.
publicKey
(),
sasThree
.
publicKey
()},
{
msgOne
,
msgTwo
,
msgThree
},
aggS
)
<<
endl
;
vector
<
BasicSAS
*>
signers
;
unsigned
time
=
10
;
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
BasicSAS
*
s
=
new
BasicSAS
{
pp
};
signers
.
push_back
(
s
);
}
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
signers
[
i
]
->
Keygen
();
}
vector
<
string
>
msgs
;
vector
<
Integer
>
signatures
;
vector
<
PK
>
pks
;
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
msgs
.
push_back
(
std
::
to_string
(
i
));
signatures
.
push_back
(
signers
[
i
]
->
sign
(
msgs
[
i
],
time
));
pks
.
push_back
(
signers
[
i
]
->
publicKey
());
}
Integer
aggS
{
signers
.
front
()
->
aggregate
(
time
,
signatures
)};
cout
<<
signers
.
front
()
->
aggregateVerify
(
time
,
pks
,
msgs
,
aggS
)
<<
endl
;
}
\ No newline at end of file
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录