Skip to content

djb2a

djb2a(data, seed?): number

Defined in: hash/djb2.ts:38

Computes the djb2a hash (the XOR variant of djb2) of data.

Replaces the addition of the original djb2 with a XOR: hash = hash * 33 ^ byte. The XOR spreads each input byte over more of the state than the addition does, giving modestly better dispersion at identical cost.

Complexity: O(n) in the byte length of data.

Uint8Array

The bytes to hash.

number = OFFSET_BASIS_

The initial state, defaulting to the canonical basis 5381.

number

An unsigned 32-bit digest.