Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbaikge/rabinkarp
Golang Rabin-Karp hash
https://github.com/jbaikge/rabinkarp
Last synced: 11 days ago
JSON representation
Golang Rabin-Karp hash
- Host: GitHub
- URL: https://github.com/jbaikge/rabinkarp
- Owner: jbaikge
- License: unlicense
- Created: 2013-07-18T14:13:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-18T14:51:40.000Z (over 11 years ago)
- Last Synced: 2024-06-19T10:10:22.344Z (5 months ago)
- Language: Go
- Size: 109 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rabinkarp
=========Rabin-Karp implementation for [Golang's hash package](http://golang.org/pkg/hash)
Installation
------------go get github.com/jbaikge/rabinkarp
Usage
-----Most useful for generating numeric hashes for short []byte slices (words):
package main
import (
"fmt"
"github.com/jbaikge/rabinkarp"
)func main() {
h := rabinkarp.New32()
words := [][]byte{
[]byte(`monkey`),
[]byte(`elephant`),
}
for _, word := range words {
h.Write(word)
fmt.Printf("%s: %d\n", word, h.Sum32())
h.Reset()
}
}Output:
monkey: 663992827
elephant: 1878464849