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

Reduce hasher code duplication #142

Open
mborland opened this issue Dec 5, 2024 · 1 comment
Open

Reduce hasher code duplication #142

mborland opened this issue Dec 5, 2024 · 1 comment

Comments

@mborland
Copy link
Member

mborland commented Dec 5, 2024

All of the files contain a million copy and pasted interfaces. Instead I think we should do this more like C.

template <typename HasherType, typename T>
auto hash(HasherType h, std::span<T> s)
{
    h.init();
    h.update(s.data(), s.size());
    const auto result = h.get_digest();
    h.destroy();
    return result;
}

Same thing with update(h, s) and so on and so forth. Discussion of something similar is going on in the Hash2 review. Thoughts @ckormanyos

@mborland
Copy link
Member Author

mborland commented Dec 5, 2024

I think this would also help reduce our exposure in #141

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

No branches or pull requests

1 participant