Skip to content

multi: Use blake256.NewHasher256 instead of New#3735

Merged
davecgh merged 1 commit into
decred:masterfrom
jholdstock:newhasher
Jul 16, 2026
Merged

multi: Use blake256.NewHasher256 instead of New#3735
davecgh merged 1 commit into
decred:masterfrom
jholdstock:newhasher

Conversation

@jholdstock

Copy link
Copy Markdown
Member

Callers should prefer NewHasher256 over New since it returns a concrete type that has more functionality and allows avoiding additional allocations.

Callers should prefer NewHasher256 over New since it returns a concrete
type that has more functionality and allows avoiding additional
allocations.

@davecgh davecgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't really make any difference in these particular cases because it's only used with method that take a hash.Hash interface, but it's still a good idea.

Technically, those methods could type assert and be more efficient when they notice it's of the right type if they wanted to.

@davecgh davecgh added this to the 2.2.0 milestone Jul 16, 2026
@davecgh
davecgh merged commit 445bc40 into decred:master Jul 16, 2026
32 checks passed
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