|
Boost : |
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2024-12-10 15:42:35
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
>> <boost_at_[hidden] <mailto:boost_at_[hidden]>> 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:
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk