anchor.diff:  -type chash() :: chash:chash() | node().
   
   %% API
  --export([init/1, cleanup/0, get_chash_ring/0, set_chash_ring/1, get_node/1,
  -    get_nodes/2, get_all_nodes/0,
  -    create_label/2, get_label_hash_part/1, has_hash_part/1, get_hash_part_length/0]).
  +-export([init/1, cleanup/0, get_chash_ring/0, set_chash_ring/1,
  +    get_node/1, get_nodes/2, get_all_nodes/0,
  +    get_hashing_key/1, gen_hashing_key/0, has_hash_part/1, create_label/2]).
   
   -define(SINGLE_NODE_CHASH(Node), Node).
   -define(IS_SINGLE_NODE_CHASH(CHash), is_atom(CHash)).
  
positive.code: 
  %%--------------------------------------------------------------------
  %% @doc
  %% Verifies whether Label has hash part (part used to choose node) defined.
  %% @end
  %%--------------------------------------------------------------------
  -spec has_hash_part(term()) -> boolean().
  has_hash_part(Label) when is_binary(Label) ->
      get_label_hash_part(Label) =/= undefined;
  has_hash_part(_Label) ->
      false.
  
  %%--------------------------------------------------------------------
  %% @doc
  %% Get number of bytes used to generate Index for binary labels.
  %% @end
  %%--------------------------------------------------------------------
  -spec get_hash_part_length() -> non_neg_integer().
  get_hash_part_length() ->
      ?HASH_LENGTH.
  
  %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  
  %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Get key used to choose node.
  %% @end
  %%--------------------------------------------------------------------
  -spec get_key(term()) -> term().
  get_key(Label) when is_binary(Label) ->
      case get_label_hash_part(Label) of
          undefined ->
              Len = byte_size(Label),
              binary:part(Label, Len, -1 * min(?HASH_LENGTH, Len));
          Hash -> Hash
      end;
  get_key(Label) ->
      Label.
  
  %%--------------------------------------------------------------------
  %% @private
  %% @doc
  %% Get hash index of nth node in ring.
  %% @end
  %%--------------------------------------------------------------------
  
negative.code:         Node when ?IS_SINGLE_NODE_CHASH(Node) ->
              Node;
          CHash ->
              Index = chash:key_of(get_hashing_key(Label)),
              [{_, BestNode}] = chash:successors(Index, CHash, 1),
              BestNode
      end.
  