RabinHash

Calculates a rolling Rabin Fingerprint.

Constructors

this
this(Pol pol)

Initializes this RabinHash with the given polynomial.

Members

Aliases

Digest
alias Digest = ulong

Base type for the calculated digest.

Functions

commit
void commit(Writer writer)

Commit a Writer.

finish
Digest finish()

Return current digest, then reset.

getWriter
Writer getWriter()

Return a fast writer object. Must be committed at the end using commit.

put
void put(R bytes)

Slide in all bytes. Note that using more bytes than windowSize is ineffectual, and only the last windowSize bytes affect the final digest.

putUntil
size_t putUntil(R bytes, Digest mask)

Keep sliding in bytes until digest & mask == 0. Return number of bytes written, which will always be less than bytes.length if mask matched.

slide
void slide(ubyte b)

Slide in one byte (and slide out the corresponding byte from the sliding window).

start
void start()

Reset internal state.

Properties

peek
Digest peek [@property getter]

Return current digest.

Structs

Writer
struct Writer

Type for fast writing of successive bytes. Contains only scalar values, so that optimizing compilers may break it up and place the fields in registers.

Variables

windowSize
enum size_t windowSize;

Size of the sliding window.

Meta