-
Notifications
You must be signed in to change notification settings - Fork 0
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
add: MD5 implementation #13
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe update enriches the system by incorporating the Message Digest version 5 (MD5) hashing function, with a nod to RFC 1321 for MD5 specifics and the addition of a trait and struct for MD5 functionalities. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 2
Out of diff range and nitpick comments (2)
README.md (2)
Line range hint
4-4
: Consider revising the phrase "research of:" to "research in" to avoid grammatical issues with the use of a colon after a preposition.
Line range hint
6-6
: Ensure that headings are surrounded by blank lines for better readability and to adhere to Markdown best practices.- ## Browsing the codebase + + ## Browsing the codebase +
README.md
Outdated
@@ -14,3 +14,4 @@ cd Cryptography-Research && cargo test | |||
- **\[Sha97\]**: Shamir's secret sharing https://apps.dtic.mil/sti/pdfs/ADA069397.pdf. |
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.
Lists in Markdown should be surrounded by blank lines to improve readability and maintain consistency with Markdown formatting standards.
- ## References
+
+ ## References
+
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
- **\[Sha97\]**: Shamir's secret sharing https://apps.dtic.mil/sti/pdfs/ADA069397.pdf. |
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.
Actionable comments posted: 5
Out of diff range and nitpick comments (1)
[rfc1321]message-digest-v5-hash/src/lib.rs (1)
18-52
: The structMessageDigestV5
and its methodnew
are well-defined. However, consider documenting the purpose of each field and method to enhance maintainability and understanding for future developers.
trait MerkleDamgard { | ||
type InternalState; | ||
type Chunk; | ||
type HashOutput; | ||
|
||
/// An MD-compliant input padding logic | ||
fn pad_input(message: &[u8]) -> Vec<Self::Chunk>; | ||
|
||
/// Compressor step to consume a chunk and affect the state | ||
fn apply_compressor(state: &mut Self::InternalState, chunk: Self::Chunk); | ||
|
||
/// Final output producer | ||
fn finalize() -> Self::HashOutput; |
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.
Ensure that the trait MerkleDamgard
is public if it is intended to be used outside this module.
- trait MerkleDamgard {
+ pub trait MerkleDamgard {
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
trait MerkleDamgard { | |
type InternalState; | |
type Chunk; | |
type HashOutput; | |
/// An MD-compliant input padding logic | |
fn pad_input(message: &[u8]) -> Vec<Self::Chunk>; | |
/// Compressor step to consume a chunk and affect the state | |
fn apply_compressor(state: &mut Self::InternalState, chunk: Self::Chunk); | |
/// Final output producer | |
fn finalize() -> Self::HashOutput; | |
pub trait MerkleDamgard { | |
type InternalState; | |
type Chunk; | |
type HashOutput; | |
/// An MD-compliant input padding logic | |
fn pad_input(message: &[u8]) -> Vec<Self::Chunk>; | |
/// Compressor step to consume a chunk and affect the state | |
fn apply_compressor(state: &mut Self::InternalState, chunk: Self::Chunk); | |
/// Final output producer | |
fn finalize() -> Self::HashOutput; |
fn pad_input(message: &[u8]) -> Vec<Self::Chunk> { | ||
todo!() | ||
} | ||
|
||
fn apply_compressor(state: &mut Self::InternalState, chunk: Self::Chunk) { | ||
todo!() | ||
} | ||
|
||
fn finalize() -> Self::HashOutput { | ||
todo!() | ||
} |
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.
Complete the implementations of pad_input
, apply_compressor
, and finalize
methods or provide detailed TODO comments explaining the intended next steps.
Would you like assistance in implementing these methods or should I open a GitHub issue to track this task?
#[test] | ||
fn two() { | ||
assert!(2 == 2); | ||
} |
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.
The test function two
only checks a trivial condition. Consider adding more comprehensive tests that cover the functionality of MessageDigestV5
.
Would you like me to help generate more detailed unit tests?
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Actionable comments posted: 1
Out of diff range and nitpick comments (3)
README.md (3)
Line range hint
4-4
: Consider revising the punctuation in the repository description to enhance clarity.- A single repository that hosts my "in-code" research of: protocols, ZK, cryptography, rust etc. + A single repository that hosts my "in-code" research of protocols, ZK, cryptography, rust etc.
Line range hint
6-6
: Remove duplicated phrase to improve clarity.- The codebase is mostly split into different directories depending on the specific ideas that they tackle. While mostly consistent with this scheme, there may be deviations. Download the codebase locally and run as follows: + The codebase is mostly split into different directories depending on the specific ideas that they tackle. While mostly consistent with this scheme, there may be deviations. Download locally and run as follows:
Line range hint
8-8
: Ensure fenced code blocks are surrounded by blank lines for proper Markdown formatting.+ git clone git@github.com:supragya/Cryptography-Research.git cd Cryptography-Research && cargo test +
- **\[Sha97\]**: Shamir's secret sharing https://apps.dtic.mil/sti/pdfs/ADA069397.pdf. | ||
- **\[Fel87\]**: Feldman's verifiable secret sharing https://www.zkdocs.com/docs/zkdocs/protocol-primitives/verifiable-secret-sharing/ | ||
- **\[Sch91\]**: Schnorr's DLog PoK https://www.zkdocs.com/docs/zkdocs/zero-knowledge-protocols/schnorr/ | ||
- **\[Sha97\]**: [Shamir's secret sharing](https://apps.dtic.mil/sti/pdfs/ADA069397.pdf) |
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.
Add blank lines around the list for better Markdown formatting.
+
- **\[Sha97\]**: [Shamir's secret sharing](https://apps.dtic.mil/sti/pdfs/ADA069397.pdf)
+
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
- **\[Sha97\]**: [Shamir's secret sharing](https://apps.dtic.mil/sti/pdfs/ADA069397.pdf) | |
**\[Sha97\]**: [Shamir's secret sharing](https://apps.dtic.mil/sti/pdfs/ADA069397.pdf) | |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- [rfc1321]message-digest-v5-hash/README.md (1 hunks)
Additional Context Used
LanguageTool (1)
[rfc1321]message-digest-v5-hash/README.md (1)
Near line 2: Unpaired symbol: ‘]’ seems to be missing
Context: ...igest version 5 See associated info at: [here](https://hackmd.io/@sraj/zk-hashfun...
Additional comments not posted (2)
[rfc1321]message-digest-v5-hash/README.md (2)
1-1
: Title is clear and relevant to the content.
4-4
: Section heading is appropriately formatted.
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- [rfc1321]message-digest-v5-hash/README.md (1 hunks)
Additional Context Used
LanguageTool (1)
[rfc1321]message-digest-v5-hash/README.md (1)
Near line 3: Unpaired symbol: ‘]’ seems to be missing
Context: ...gest version 5 See associated info at: [here](https://hackmd.io/@sraj/zk-hashfun...
Additional comments not posted (2)
[rfc1321]message-digest-v5-hash/README.md (2)
1-2
: Title formatting looks good.
5-5
: References section is correctly formatted.
@@ -0,0 +1,5 @@ | |||
# Message Digest version 5 | |||
|
|||
See associated info at: [here](https://hackmd.io/@sraj/zk-hashfunc-comparison) |
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.
Consider improving the link text to be more descriptive than "here" to enhance document readability.
- See associated info at: [here](https://hackmd.io/@sraj/zk-hashfunc-comparison)
+ See associated info at: [Comparative Analysis of Hash Functions](https://hackmd.io/@sraj/zk-hashfunc-comparison)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
See associated info at: [here](https://hackmd.io/@sraj/zk-hashfunc-comparison) | |
See associated info at: [Comparative Analysis of Hash Functions](https://hackmd.io/@sraj/zk-hashfunc-comparison) |
No description provided.