-
Couldn't load subscription status.
- Fork 26
Digest: Public API (draft) #1140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
wysiwys
wants to merge
16
commits into
main
Choose a base branch
from
wysiwys/digest-public-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
394175f
require `Default` implementation for state
wysiwys 09a73d6
implement oneshot API for Blake2
wysiwys 9bec03e
begin implementing standalone `libcrux-digest` crate
wysiwys e3e529e
derive `Default` for `Blake2sHash`
wysiwys 1530ffb
require `new()` initialization with error handling instead of `Default`
wysiwys 08e4baf
add documentation
wysiwys d505f38
implement `new()` for sha2 digest state initialization
wysiwys d2f56e1
begin implementing new Digest public API
wysiwys 8388168
public API implementation in digest crates
wysiwys f77fe28
reexport hashers and digest algorithm implementations
wysiwys c80d836
check digest length validity and implement `HashError`
wysiwys cdee4c7
separate Blake2 implementations into const digest size and runtime di…
wysiwys 5389206
implement multiplexed `Hash`
wysiwys 1d74fd0
add `new_digest()` method
wysiwys eaa63ac
derive `Debug`
wysiwys 49b2f21
add tests for multiplexed hash
wysiwys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,23 @@ | ||
| [package] | ||
| description = "Formally verified digest library" | ||
| name = "libcrux-digest" | ||
| readme = "Readme.md" | ||
| version = "0.0.3" | ||
|
|
||
| authors.workspace = true | ||
| edition.workspace = true | ||
| homepage.workspace = true | ||
| license.workspace = true | ||
| repository.workspace = true | ||
|
|
||
| [dependencies] | ||
| libcrux-blake2 = { version = "0.0.3", path = "../../../blake2", optional = true } | ||
| libcrux-sha2 = { version = "0.0.3", path = "../../../sha2", optional = true } | ||
| libcrux-sha3 = { version = "0.0.3", path = "../../../libcrux-sha3", optional = true } | ||
| libcrux-traits = { version = "0.0.3", path = "../../../traits", optional = true } | ||
|
|
||
| [features] | ||
| blake2 = ["dep:libcrux-blake2", "dep:libcrux-traits"] | ||
| default = ["blake2", "sha2", "sha3"] | ||
| sha2 = ["dep:libcrux-sha2", "dep:libcrux-traits"] | ||
| sha3 = ["dep:libcrux-sha3", "dep:libcrux-traits"] |
This file contains hidden or 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 @@ | ||
| mod multiplexed; | ||
|
|
||
| pub use multiplexed::*; | ||
|
|
||
| #[cfg(feature = "blake2")] | ||
| pub mod blake2 { | ||
|
|
||
| pub use libcrux_blake2::{ | ||
| Blake2bHash as Blake2b, Blake2bHasher, Blake2sHash as Blake2s, Blake2sHasher, | ||
| ConstDigestLen, RuntimeDigestLen, | ||
| }; | ||
| } | ||
|
|
||
| #[cfg(feature = "sha2")] | ||
| pub mod sha2 { | ||
|
|
||
| pub use libcrux_sha2::{ | ||
| Sha224Hash as Sha2_224, Sha224Hasher as Sha2_224Hasher, Sha256Hash as Sha2_256, | ||
| Sha256Hasher as Sha2_256Hasher, Sha384Hash as Sha2_384, Sha384Hasher as Sha2_384Hasher, | ||
| Sha512Hash as Sha2_512, Sha512Hasher as Sha2_512Hasher, | ||
| }; | ||
| } | ||
|
|
||
| #[cfg(feature = "sha3")] | ||
| pub mod sha3 { | ||
|
|
||
| pub use libcrux_sha3::{ | ||
| Sha3_224, Sha3_224Hasher, Sha3_256, Sha3_256Hasher, Sha3_384, Sha3_384Hasher, Sha3_512, | ||
| Sha3_512Hasher, | ||
| }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a lot of code for just calling a hash function.
I'd want to call something like
Blake2sHash::hash(digest_mut, b"this is a test"). It's not clear why the extra two lines are necessary.