Skip to content
No description, website, or topics provided.
  1. Other 100.0%
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status


A perl6 implementation of a Consistent Hash.


A "consistent" hash allows the user to create a data structure in which a set of string flags are entered in the hash at intervals specified by the CRC32 hash of the flag. Optionally, each flag can have suffixes appended to it in order to create multiple entries in the hash.

Once flags are entered into the hash, we can find which flag would be associated with a candidate string of our choice. A typical use-case for this is to enter host names into the hash the represent destination hosts where values are stored for particular keys, as determined by the result of searching for the corresponding flag in the hash.

This technique is best explained in these links:


use v6;
use Hash::Consistent;
use String::CRC32;
use Test;

my $ch =>2);
is $ch.sum_list.elems(), 4, 'correct hash cardinality';
# > $ch.print();
# 0: 2725249910 [crc32 of derived from]
# 1: 3210990709 [crc32 of derived from]
# 2: 3362055395 [crc32 of derived from]
# 3: 3581359072 [crc32 of derived from]

# > String::CRC32::crc32('blah');
# 3458818396
# (should find next at 3581359072 ->
is $ch.find('blah'), '', 'found blah ->';

# > String::CRC32::crc32('whee');
# 3023755156
# (should find next at 3210990709 ->
is $ch.find('whee'), '', 'found whee ->';


Brad Clawsie (PAUSE:bradclawsie,


This module is licensed under the BSD license, see:

You can’t perform that action at this time.