Skip to content

Optimization#20

Open
volatilflerovium wants to merge 6 commits into
vog:masterfrom
volatilflerovium:Optimization
Open

Optimization#20
volatilflerovium wants to merge 6 commits into
vog:masterfrom
volatilflerovium:Optimization

Conversation

@volatilflerovium

@volatilflerovium volatilflerovium commented Jan 19, 2026

Copy link
Copy Markdown

Encapsulate static variables and functions into the SHA1 class. (see #17)

Add:

  • std::string SHA1::operator()(const char* str);
  • std::string SHA1::operator()(const std::string& str);
  • bool SHA1::operator()(const char* fileName, std::string& hashSum);
  • bool SHA1::operator()(const std::string& fileName, std::string& hashSum);
  • std::string SHA1::getError();
  • CMakeLists.txt
  • Performance test directory

Add Compiler flags -g -O3 to MakeFile
Ignore build and bin directories
Add performance.txt
Remove parameter uint32_t block from SHA1::blk, SHA1::R0, SHA1::R1, SHA1::R2, SHA1::R3, SHA1::R4
Remove parameters from SHA1::transform and SHA1::buffer_to_block, SHA1::reset

@vog vog left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

All in all, very good work. Thanks a lot! My review mostly consists of minor change requests, complaining on a high level.

Comment thread sha1.hpp Outdated
Comment thread sha1.hpp Outdated
Comment thread sha1.hpp Outdated
Comment thread sha1.hpp Outdated
Comment thread sha1.hpp
Comment thread sha1.hpp Outdated
Comment thread sha1.hpp Outdated
* sha1.final();
* is the same than
* sha1.update(str1 + str2 + str3);
* sha1.final();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The above multi-line comment describes the usage of multiple functions in combination. Wouldn't a sub section in README.md be a better place for that?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Most of the times, users of a library will check the headers for documentation. Also consider that many times users only download the headers and forget where it comes from.

This is only what I consider a reason for the comments to stay in the header, but if you still want to move this and the next two comments to the README, that is fine.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I see why you proposed it that way, but would still prefer to have it in the README.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks again for your efforts. This is still highly appreciated!

Comment thread sha1.hpp Outdated
*
* @return return the sha1sum of the string (or strings)
* fed by calls to SHA1::update.
* */

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This multi-line comment is just a repetition of the above comment (the one that should go into the README). So this can and should be removed, to avoid becoming stale (and as time passes, perhaps even incorrect).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The previous comment (for SHA1::update) demonstrates the usage for SHA1::update, and this comment makes explicit that SHA1::final should be used only after the last SHA1::update. (See previous comment)

Comment thread sha1.hpp Outdated
*
* @return return the sha1sum of the content of the specified file.
*
* */

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please move this comment to a more visible place in the README (as with the above comments).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

See one of my previous comments.

Comment thread sha1.hpp Outdated
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.

2 participants