buzhash: github.com/silvasur/buzhash Index | Files

package buzhash

import "github.com/silvasur/buzhash"

Package buzhash implements a buzhash algorithm using this defintion: http://en.wikipedia.org/wiki/Rolling_hash#Cyclic_polynomial

BuzHash is a rolling hash function, that means that the current sum will always be the sum of the last n input bytes.


Package Files


type BuzHash Uses

type BuzHash struct {
    // contains filtered or unexported fields

BuzHash implements the hash.Hash32 interface and also has a function to write a single byte.

func NewBuzHash Uses

func NewBuzHash(n uint32) *BuzHash

NewBuzHash generates and initializes a new BuzHash object with block size n

func (*BuzHash) BlockSize Uses

func (bh *BuzHash) BlockSize() int

func (*BuzHash) HashByte Uses

func (bh *BuzHash) HashByte(b byte) uint32

HashByte updates the hash with a single byte and returns the resulting sum

func (*BuzHash) Reset Uses

func (bh *BuzHash) Reset()

func (*BuzHash) Size Uses

func (bh *BuzHash) Size() int

func (*BuzHash) Sum Uses

func (bh *BuzHash) Sum(b []byte) []byte

Sum appends the (little endian) checksum to b

func (*BuzHash) Sum32 Uses

func (bh *BuzHash) Sum32() uint32

func (*BuzHash) Write Uses

func (bh *BuzHash) Write(p []byte) (int, error)

Write updates the hash with the bytes from slice p

Package buzhash imports 2 packages (graph) and is imported by 1 packages. Updated 2016-08-26. Refresh now. Tools for package owners.