Closed
Description
A way to serialize state of the Sm3
hash function was requested in #304. Do we want to implement the serde
traits for hash functions (behind an optional feature)? It may be useful in some cases for transferring state for partially hashed messages.
Reasons against it:
- Hash functions generally work on blocks, thus serialized states can include unprocessed parts of a potentially sensitive message.
- Implementation of the
serde
traits somewhat restricts our freedom of changing inner representation of hash functions. Currently all functions have the same state representation regardless of target architecture or available CPU features, but it may change in future. - It does not look like state serialization of hash functions is a common enough problem.
Currently I am leaning towards the "against" position, but I think it's worth to discuss it nevertheless.