
On 12/10/24 18:05, Andrey Semashev wrote:
On 12/10/24 17:50, Vinnie Falco wrote:
On Tue, Dec 10, 2024 at 5:09 AM Andrey Semashev via Boost
mailto:boost@lists.boost.org> wrote: Copyability is a rather strong requirement, which may not be supported by all implementations.
Could you please provide an example of a non-copyable HashAlgorithm? I'm struggling to see it.
The primary use case I had in mind is wrapping an external library, where the external library does not support creating a deep copy of the algorithm state. This is the case with libsodium (https://doc.libsodium.org/hashing/generic_hashing), for example.
I should clarify that libsodium uses structs for storing the state of the hashing algorithms. For example, for SHA2-256 the struct is crypto_hash_sha256_state: https://github.com/jedisct1/libsodium/blob/bfa6ee638673dc88c51331dc13e8f112f... As far as I could see, the documentation makes no guarantees about the contents of this struct and whether it is safe to memcpy it. So, even if the struct can be copied as bytes, I still don't consider copying as properly supported by the library, as one has to rely on implementation details.