Skip to content

feat: Added MD5 hashing algorithm #1519

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

Merged
merged 16 commits into from
Oct 30, 2023
Merged

feat: Added MD5 hashing algorithm #1519

merged 16 commits into from
Oct 30, 2023

Conversation

ManpreetXSingh
Copy link
Contributor

@ManpreetXSingh ManpreetXSingh commented Oct 12, 2023

Open in Gitpod know more

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is pretty messy because it juggles various representations of bytes that aren't really suitable (strings of bits encoded as ASCII 0 / 1 etc.)
It should be changed to just use Uint8Array wherever byte arrays are needed, and simply numbers wherever 4 byte "words" are needed. The string representations (and the code for dealing with them) should be gotten rid of entirely.

Also needs tests.

@ManpreetXSingh
Copy link
Contributor Author

Hi @appgurueu,
Thanks for the feedback!
Actually I'm quite new to the js world. I looked at the SHA implementations in the nearby files and assumed that it's the right way to do it. I'll try my best to fix the issues and make the code cleaner.

@appgurueu
Copy link
Collaborator

[...] I looked at the SHA implementations in the nearby files and assumed that it's the right way to do it. [...]

Ah, sorry about that. We have much legacy code lying around that needs to be refactored and definitely isn't a good example. We should make it more clear in the contribution guidelines that much of the legacy codebase shouldn't be taken as a good example.

@ManpreetXSingh
Copy link
Contributor Author

Hi @appgurueu,
I believe I have implemented all of the requested changes. Please let me know if any additional adjustments are needed.

@appgurueu appgurueu added the hacktoberfest-accepted Accepted to be counted towards Hacktoberfest label Oct 28, 2023
@appgurueu
Copy link
Collaborator

Adding the hacktoberfest-accepted label in case we don't get this merged before October ends; the PR is almost there!

@raklaptudirm raklaptudirm merged commit 889d9c3 into TheAlgorithms:master Oct 30, 2023
@ManpreetXSingh
Copy link
Contributor Author

ManpreetXSingh commented Oct 30, 2023

Thanks! 😊

@appgurueu
Copy link
Collaborator

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted to be counted towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants