Skip to content

Simplify ObjectHasher and prepare to remove plumbing/hash#27

Merged
pjbgf merged 4 commits into
pjbgf:sha256-openfrom
aymanbagabas:sha256-open-comb
Apr 27, 2025
Merged

Simplify ObjectHasher and prepare to remove plumbing/hash#27
pjbgf merged 4 commits into
pjbgf:sha256-openfrom
aymanbagabas:sha256-open-comb

Conversation

@aymanbagabas

Copy link
Copy Markdown

This simplify and combines the implementation of ObjectHasher to be hasher agnostic and makes it based on ObjectFormat. Now, NewHasher takes an ObjectFormat to determine the hash function to use. It also changes the ObjectFormat type from string to an int with format.SHA1 = 0 which makes SHA1 the default format when omitted.

Comment thread plumbing/hash.go Outdated
Comment thread plumbing/objectid.go Outdated
This commit changes the ObjectFormat type from a string to an int. This
would make a default ObjectFormat declaration default to SHA1. A string
function is defined to return the string representation of the ObjectFormat.
This combines the ObjectHasher implementation to be hash function
agnostic. The SHA1 and SHA256 implementations are now combined into a
single implementation that uses the given format to determine the
hash function to use.
@pjbgf pjbgf merged commit 2b3b70e into pjbgf:sha256-open Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants