Skip to content

chain-crypto: More disciplined digest API #68

Open
@mzabaluev

Description

@mzabaluev

The method DigestOf::digest_with is arguably too loose for library API: it allows any closure to calculate a digest of an object, which is however, tied to the object type by its type parameter.

To reduce possibility of sneaky errors, this method should be replaced by a different method using a new trait similar to std::hash::Hash, which object types would need to implement to support calculation of a digest on their contents in a single canonical way.

DigestOf::coerce suffers from similar looseness, but at least its intent is explicit in the code. Its only usage so far is in a quickcheck Arbitrary impl for DigestOf, which is rather hackish.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions