No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information.
lib/Hash kebab-case funcs and bump license year Feb 1, 2017
t merge tests Jan 1, 2016
.gitignore added Dec 15, 2015
.travis.yml travis.ymp dep Jan 20, 2017
LICENSE kebab-case funcs and bump license year Feb 1, 2017
META6.json better errors Jan 20, 2017 docs Jan 21, 2017

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: