anchor.diff:      write_db_doc(Doc).
   
   for_key(DbName, Key) ->
  -    HashKey = hash_int(hash(Key)),
  +    <<HashKey:160/integer>> = hash(Key),
       Head = #shard{
           name = '_',
           node = '_',
  
positive.code:                name=shard_name(Beg,DbName)}
      end, Partners).
  
  
  %% @doc turn hash into an integer
  hash_int(Hash) when is_binary(Hash) ->
      <<IndexAsInt:160/integer>> = Hash,
      IndexAsInt;
  hash_int(Hash) when is_integer(Hash) ->
      Hash.
  
  %% @doc size of one partition in the ring
  partition_range(Q) ->
      trunc( ?RINGTOP / Q ).  % SHA-1 space / Q
  
negative.code: 
  %% @doc hash the dbname, and return the corresponding node for seeding a ring
  seednode(DbName, Nodes) ->
      <<HashInt:160/integer>> = hash(DbName),
      Size = partition_range(length(Nodes)),
      Factor = (HashInt div Size),
      lists:nth(Factor+1, Nodes).
  