Skip to content

Figure out what to do about digests #192

@panhania

Description

@panhania

Currently in a lot of places in the codebase we use types like [u8; 32] to represent hash digests. These work but this does not feel super-idiomatic and type safety could be improved.

Generally, we use the digest crate and its derivatives (e.g. sha2) for hash calculation. Unfortunately, the crate is very, very abstracted and does not expose any "simple" hash type for output of each algorithm that we could use. Moreover, because everything works on traits, each time we need to use it, we need appropriate traits into scope which does not help with the noise.

Ideally, we should define our own new-type wrappers for each digest algorithm with an interface that best fits our (simple) use-cases. We should do it uniformly across all our internal usages at once to prevent xkcd#927 situation, preferably even totally hiding our reliance on digest.

An extra layer of complexity in this case is that the get_file_metadata action has conditional features for each digest algorithm dependency. For this to work, we will likely need an extra feature for each on top of that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions