-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from fjarri/specialty-hashing
Get rid of exposed domain separation tags and use dedicated functions instead
- Loading branch information
Showing
6 changed files
with
49 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! This module contains hashing sequences with included domain separation tags | ||
//! shared between different parts of the code. | ||
use crate::curve::{CurvePoint, CurveScalar}; | ||
use crate::hashing::ScalarDigest; | ||
|
||
pub(crate) fn hash_to_polynomial_arg( | ||
precursor: &CurvePoint, | ||
pubkey: &CurvePoint, | ||
dh_point: &CurvePoint, | ||
id: &CurveScalar, | ||
) -> CurveScalar { | ||
ScalarDigest::new_with_dst(b"POLYNOMIAL_ARG") | ||
.chain_point(precursor) | ||
.chain_point(pubkey) | ||
.chain_point(dh_point) | ||
.chain_scalar(id) | ||
.finalize() | ||
} | ||
|
||
pub(crate) fn hash_to_shared_secret( | ||
precursor: &CurvePoint, | ||
pubkey: &CurvePoint, | ||
dh_point: &CurvePoint, | ||
) -> CurveScalar { | ||
ScalarDigest::new_with_dst(b"SHARED_SECRET") | ||
.chain_point(precursor) | ||
.chain_point(pubkey) | ||
.chain_point(dh_point) | ||
.finalize() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters