khasher

package module
v0.0.0-...-a48e7c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2016 License: MIT Imports: 1 Imported by: 0

README

khasher

KHasher is a simple utility to create k number of hashes out of two hash functions only.

Which is an implementation of the hashing functions mentioned in this paper.

A similar algorithm was also mentioned in The Art of Computer Programing Vol.3 Sorting and Searching In the section of double hashing open adderssing.

Example


import (
    "fmt"

    "github.com/lafikl/khasher"
)
func main() {
    kh := khasher.NewKHasher(5)
    size_of_table := uint32(67)
    hashes, err := kh.Hash([]byte("Donald E.K"), size_of_table)
    if err != nil {
        panic(err)
    }
    fmt.Println(hashes)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KHasher

type KHasher struct {
	// contains filtered or unexported fields
}

KHasher is an implementation of the hashing functions mentioned in the paper https://www.eecs.harvard.edu/~michaelm/postscripts/rsa2008.pdf A similar algorithm was mentioned in The Art of Computer Programing Vol.3 Sorting and Searching In the section of double hashing open adderssing.

func NewKHasher

func NewKHasher(k int) *KHasher

NewKHasher creates a new instance of the hasher

func (*KHasher) Hash

func (k *KHasher) Hash(key []byte, m uint32) ([]uint32, error)

Hash returns K number of hash values of the given key m is the size of the hash table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL