mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-26 13:39:37 +00:00
Hash the message before the challenge function in the Schnorr contract
Slightly more efficient.
This commit is contained in:
parent
cc75a92641
commit
7feb7aed22
3 changed files with 3 additions and 3 deletions
|
@ -15,7 +15,7 @@ library Schnorr {
|
||||||
// message := the message signed
|
// message := the message signed
|
||||||
// c := Schnorr signature challenge
|
// c := Schnorr signature challenge
|
||||||
// s := Schnorr signature solution
|
// s := Schnorr signature solution
|
||||||
function verify(bytes32 px, bytes memory message, bytes32 c, bytes32 s)
|
function verify(bytes32 px, bytes32 message, bytes32 c, bytes32 s)
|
||||||
internal
|
internal
|
||||||
pure
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
|
|
|
@ -9,6 +9,6 @@ contract TestSchnorr {
|
||||||
pure
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return Schnorr.verify(public_key, message, c, s);
|
return Schnorr.verify(public_key, keccak256(message), c, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl Signature {
|
||||||
&Keccak256::digest(x_and_y_coordinates)[12 ..]
|
&Keccak256::digest(x_and_y_coordinates)[12 ..]
|
||||||
});
|
});
|
||||||
hash.update(key.eth_repr());
|
hash.update(key.eth_repr());
|
||||||
hash.update(message);
|
hash.update(Keccak256::digest(message));
|
||||||
<Scalar as Reduce<KU256>>::reduce_bytes(&hash.finalize())
|
<Scalar as Reduce<KU256>>::reduce_bytes(&hash.finalize())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue