adding constructors

This commit is contained in:
William Dillon 2025-05-26 19:16:56 -04:00
parent ce83baa68c
commit 45b33e8013

View File

@ -2,6 +2,7 @@ package mishmash
import ( import (
"fmt" "fmt"
"hash"
"os" "os"
"strconv" "strconv"
"strings" "strings"
@ -96,6 +97,10 @@ type Mishmash32 struct {
accumulator uint64 accumulator uint64
} }
func New32() hash.Hash32 {
return &Mishmash32{}
}
// Sum appends the current hash to b and returns the resulting slice. // Sum appends the current hash to b and returns the resulting slice.
// It does not change the underlying hash state. // It does not change the underlying hash state.
func (m *Mishmash32) Sum(p []byte) []byte { func (m *Mishmash32) Sum(p []byte) []byte {
@ -134,6 +139,10 @@ type Mishmash64 struct {
accumulator uint64 accumulator uint64
} }
func New64() hash.Hash64 {
return &Mishmash64{}
}
// Sum appends the current hash to b and returns the resulting slice. // Sum appends the current hash to b and returns the resulting slice.
// It does not change the underlying hash state. // It does not change the underlying hash state.
func (m *Mishmash64) Sum(p []byte) []byte { func (m *Mishmash64) Sum(p []byte) []byte {