Re:"YOLO" is not a valid hash construction
by conradludgate on Sunday August 25, 2024 @02:22AM
(#41344883)
> Note that, while many serialization methods will create unambiguous encodings, they don’t all necessarily produce unique encodings. For instance, JSON is largely insensitive to changes in whitespace and element ordering, so using JSON serializations produced by different libraries could lead to different hashes. Be careful!
Re:"YOLO" is not a valid hash construction
by JoachimSchipper on Sunday August 25, 2024 @01:27AM
(#41344633)
It's not ideal, but it's not a cryptographic risk.
Using an encoding that (like Protobuf) has multiple representations for a message may cause you problems if you switch implementations - sha256(encode(msg)) might yield different hashes on different implementations of encode().
But the main risk is an encoding that has multiple interpretations of a single encoding (e.g. sha256(encode("admin", "true")) == sha256(encode("admint", "rue"))), and Protobuf (can be unserialized, and thus) doesn't have that problem.
Proto bufs don't guarantee consistent serialization.