Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

add: MD5 implementation #13

wants to merge 5 commits into from

Conversation

supragya
Copy link
Owner

@supragya supragya commented May 3, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented May 3, 2024

Walkthrough

The 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

File Path Change Summary
README.md Added reference to RFC 1321 for MD5 hashing function and hash function comparison.
[rfc1321]message-digest-v5-hash/src/lib.rs Introduced MerkleDamgard trait and MessageDigestV5 struct with associated types and methods.
[rfc1321]message-digest-v5-hash/README.md Provided information on Message Digest version 5 with hash function comparison.

🐇✨
In the digital burrow, deep and wide,
A new hash sprang to life, with pride.
MD5, oh MD5, in bits we trust,
Secure our data, as you must.
Hop, skip, a byte, a leap —
In our code, forever keep! 🌟
🐇✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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.
Copy link
Contributor

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.

Suggested change
- **\[Sha97\]**: Shamir's secret sharing https://apps.dtic.mil/sti/pdfs/ADA069397.pdf.

README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 struct MessageDigestV5 and its method new are well-defined. However, consider documenting the purpose of each field and method to enhance maintainability and understanding for future developers.

[rfc1321]message-digest-v5-hash/README.md Show resolved Hide resolved
[rfc1321]message-digest-v5-hash/README.md Outdated Show resolved Hide resolved
Comment on lines +3 to +15
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;
Copy link
Contributor

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.

Suggested change
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;

Comment on lines +61 to +71
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!()
}
Copy link
Contributor

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?

Comment on lines +76 to +79
#[test]
fn two() {
assert!(2 == 2);
}
Copy link
Contributor

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>
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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)
Copy link
Contributor

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.

Suggested change
- **\[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)

supragya and others added 2 commits May 13, 2024 09:06
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between e708094 and 5e1ede1.
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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between 5e1ede1 and bae7450.
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)
Copy link
Contributor

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.

Suggested change
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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant