Boost logo

Boost :

From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2024-12-13 14:31:16


On Fri, 13 Dec 2024, 11:22 Peter Dimov via Boost, <boost_at_[hidden]>
wrote:

> Samuel Neves wrote:
> > One of the things that puzzles me about this library is its intended
> purpose.
> > "Types don't know #" was clearly about hash types for use in hash tables,
> > which explained why keying the hashes was mandatory. But it is unclear
> to me
> > why MD5, SHA-1, and other cryptographic hashes are present here; they are
> > way too inefficient to be of much use in hash tables, so there is little
> reason to
> > include them. If, on the other hand, this is meant as a more general
> hashing
> > library, I have strong objections as detailed below.
>
> There exist intermediate use cases between "key in a hash table" and
> "cryptographically secure hashing of a binary blob" that are also served by
> the library. Some of them are:
>
> - if you have a program with some program state S, represented by a C++
> object,
> which the user can save to disk by means of e.g. Ctrl+S, you often want
> to know
> whether the current state has been saved or not (to display an
> indicator, or to
> decide whether to autosave on exit.) This is implemented by keeping a
> hash of
> the last save, and comparing the current hash to the last saved one.
>
> - if you have something like Boost.Compute, which needs to compile shaders,
> you can keep a cache of already compiled shader binaries, along with the
> hashes
> of the source used to create them, and then skip the compilation if the
> source
> matches a hash of an already compiled binary.
>
>
> https://github.com/boostorg/compute/blob/cf7907574d6159cd43e6cf687a7b656278c61dd0/include/boost/compute/detail/meta_kernel.hpp#L364
>
> - if you need to send complex C++ objects over the network, you can first
> ask
> the remote endpoint "do you already have the object with this hash?" and
> if so,
> skip sending the object.
>

These three have been pretty clarifying for me regarding some design
decisions in the library, thanks for providing them I'd encourage you to
mention them in the docs.

Thanks,
Ruben.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk