anchor.diff:              error(chash_ring_not_initialized);
           Node when ?IS_SINGLE_NODE_CHASH(Node) ->
               Node;
  -        CHash when is_binary(Label) ->
  -            Length = min(byte_size(Label), get_label_gen_size()),
  -            Index = chash:key_of(binary:part(Label, 0, Length)),
  -            [{_, BestNode}] = chash:successors(Index, CHash, 1),
  -            BestNode;
           CHash ->
  -            Index = chash:key_of(Label),
  +            Index = chash:key_of(get_key(Label)),
               [{_, BestNode}] = chash:successors(Index, CHash, 1),
               BestNode
       end.
  
positive.code:             error(chash_ring_not_initialized);
          Node when ?IS_SINGLE_NODE_CHASH(Node) ->
              [Node];
          CHash when is_binary(Label) ->
              Length = min(byte_size(Label), get_label_gen_size()),
              Index = chash:key_of(binary:part(Label, 0, Length)),
              lists:map(fun({_, Node}) -> Node end, chash:successors(Index, CHash, NodesNum));
          CHash ->
              Index = chash:key_of(Label),
              lists:map(fun({_, Node}) -> Node end, chash:successors(Index, CHash, NodesNum))
      end.
  
  
negative.code: 
  %%--------------------------------------------------------------------
  %% @doc
  %% Creates label with part used to choose node.
  %% @end
  %%--------------------------------------------------------------------
  -spec create_label(binary(), binary()) -> binary().
  create_label(HashPart, Tail) ->
      <<?HASH_SEPARATOR, HashPart/binary, Tail/binary>>.
  
  %%--------------------------------------------------------------------
  %% @doc
  %% Gets part of the label used to choose node.
  %% @end
  %%--------------------------------------------------------------------
  -spec get_label_hash_part(binary()) -> binary() | undefined.
  get_label_hash_part(Label) ->
      case binary:split(Label, ?HASH_SEPARATOR_BIN) of
          [_, Hash | _] ->
              binary:part(Hash, 0, ?HASH_LENGTH);
          _ ->
              undefined
      end.
  
  %%--------------------------------------------------------------------
  %% @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 -> Label;
          Hash -> Hash
      end;
  get_key(Label) ->
      Label.
  
  %%--------------------------------------------------------------------
  %% @private
  