Skip to content

hash: allow Hash to implement encoding.BinaryMarshaler, encoding.BinaryUnmarshaler #20573

Closed
@Capstan

Description

@Capstan

There are some use cases that aren't met by current hashing functions

  • Serialize state of a partial byte stream processing for later work; recalculating the hash from the beginning is inefficient and, in our case, infeasible due to the size of the data and legacy compatibility requirements that inhibit use of, say, a Merkle tree.
  • Sharing calculation of common prefix hashes; this only requires in-memory copying rather than serialization.
  • Conditional append based on hash matches, which is a corollary of the previous.

Previous thread on golang-dev.

In my specific case, I'm looking for MD5 [de]serialization.

/cc @jlhawn

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions