Skip to content

packaged python implementation of a rolling hash function

Notifications You must be signed in to change notification settings

wontonst/py-rollinghash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

RollingHash

This is a python implementation of a rolling hash function. The implementation is based off the wikipedia article.

Installation

The easiest way to install is simply pip install rollinghash

Alternatively you can clone this repository and run pip install /path/to/rollinghash

Usage & API

This package is very simple to use

import rollinghash

a = rollinghash.RollingHash()
# or alternatively
a = rollinghash.RollingHash('some stuff to hash first')

# to add to the window

a.push('some more stuff')  # returns new hash of window

# get current hash
curr_hash = a.hash

# pop off first 

a.pop() # returns new hash of window

# alternatively pop more off

a.pop(10)

If you pop more than there are values, it will pop everything off and return None

About

packaged python implementation of a rolling hash function

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages