From 45b33e80135d21d34985af754a11d54142d11116 Mon Sep 17 00:00:00 2001 From: William Dillon Date: Mon, 26 May 2025 19:16:56 -0400 Subject: [PATCH] adding constructors --- mishmash.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mishmash.go b/mishmash.go index b12ca01..f64560d 100644 --- a/mishmash.go +++ b/mishmash.go @@ -2,6 +2,7 @@ package mishmash import ( "fmt" + "hash" "os" "strconv" "strings" @@ -96,6 +97,10 @@ type Mishmash32 struct { accumulator uint64 } +func New32() hash.Hash32 { + return &Mishmash32{} +} + // Sum appends the current hash to b and returns the resulting slice. // It does not change the underlying hash state. func (m *Mishmash32) Sum(p []byte) []byte { @@ -134,6 +139,10 @@ type Mishmash64 struct { accumulator uint64 } +func New64() hash.Hash64 { + return &Mishmash64{} +} + // Sum appends the current hash to b and returns the resulting slice. // It does not change the underlying hash state. func (m *Mishmash64) Sum(p []byte) []byte {