Creates hash ring.
191459
def _build_circle(self):
        
        total_weight = 0
        for node in self._nodes:
            total_weight += self._weights.get(node, 1)

        for node in self._nodes:
            weight = self._weights.get(node, 1)

            ks = math.floor((40 * len(self._nodes) * weight) / total_weight)

            for i in xrange(0, int(ks)):
                b_key = self._md5_digest('%s-%s-salt' % (node, i))

                for l in xrange(0, 4):
                    key = ((b_key[3 + l * 4] << 24)
                           | (b_key[2 + l * 4] << 16)
                           | (b_key[1 + l * 4] << 8)
                           | b_key[l * 4])

                    self._hashring[key] = node
                    self._sorted_keys.append(key)

        self._sorted_keys.sort()
1294114
protected HashMap<String, INode> createHash(IContext context) {
        HashMap<String, INode> result = new HashMap<String, INode>();

        int nodeCount = 0;
        for (INode node : context.getNodesList()) {
            result.put(getNodePathToRoot(node), node);
            nodeCount++;
        }

        if (log.isEnabledFor(Level.INFO)) {
            log.info("Created hash for " + nodeCount + " nodes...");
        }

        return result;
    }
707764
def _create_hashes(self,count):
        
        for i in range(0,count):
             #Get 1/numblocks of the hash
             blocksize = int(len(self.hexdigest) / count)
             currentstart = (1 + i) * blocksize - blocksize
             currentend = (1 +i) * blocksize
             self.hasharray.append(int(self.hexdigest[currentstart:currentend],16))

        # Workaround for adding more sets in 2019.
        # We run out of blocks, because we use some for each set, whether it's called or not.
        # I can't easily change this without invalidating every hash so far :/
        # This shouldn't reduce the security since it should only draw from one set of these in practice.
        self.hasharray = self.hasharray + self.hasharray
1166627
def create_hash(response)
      begin
        JSON.parse response
      rescue JSON::ParserError
        response
      rescue StandardError
        response
      end
    end
265962
function HashThrough (createHash) {
  const hashThrough = new Transform()

  const hash = createHash()

  hashThrough._transform = function (chunk, encoding, cb) {
    setImmediate(_ => {
      try {
        hash.update(chunk)
        cb(null, chunk)
      } catch (err) {
        cb(err)
      }
    })
  }

  // bind the digest function to hash object
  hashThrough.digest = format => hash.digest(format)

  return hashThrough
}
1342078
def make_hash_id():
    
    today = datetime.datetime.now().strftime(DATETIME_FORMAT)
    return hashlib.sha1(today.encode('utf-8')).hexdigest()
1122037
public MurmurHash hash(int input) {
		count++;

		input *= 0xcc9e2d51;
		input = Integer.rotateLeft(input, 15);
		input *= 0x1b873593;

		hash ^= input;
		hash = Integer.rotateLeft(hash, 13);
		hash = hash * 5 + 0xe6546b64;

		return this;
	}
646235
def hash(self):
        """"""
        # Do not apply filters here (speed)
        hph = self.hparent.hash
        hpfilt = hashobj(self.hparent._filter)
        dhash = hashobj(hph + hpfilt)
        return dhash
294497
def generate_by_hash(hashcode):
    """"""
    img = Image.new(IMAGE_MODE, IMAGE_SIZE, BACKGROUND_COLOR)
    if len(hashcode) < 32:
        print ("hashcode must have lenght >= 32, %s" % hashcode)
        raise FalseHashError

    allowed = "0123456789abcdef"
    hashcheck = [c in allowed for c in hashcode]
    if False in hashcheck:
        print ("hashcode has not allowed structure %s" % hashcode)
        raise FalseHashError

    pixelmap = setup_pixelmap(hashcode)
    draw_image(pixelmap, img)
    return img
904001
def __create_hashtable(self, t, level):
        """"""

        hashes = {}
        for (i, item) in enumerate(t):
            try:
                hashes_all = DeepHash(item,
                                      hashes=self.hashes,
                                      exclude_types=self.exclude_types,
                                      exclude_paths=self.exclude_paths,
                                      exclude_regex_paths=self.exclude_regex_paths,
                                      hasher=self.hasher,
                                      ignore_repetition=not self.report_repetition,
                                      significant_digits=self.significant_digits,
                                      number_format_notation=self.number_format_notation,
                                      ignore_string_type_changes=self.ignore_string_type_changes,
                                      ignore_numeric_type_changes=self.ignore_numeric_type_changes,
                                      ignore_type_in_groups=self.ignore_type_in_groups,
                                      ignore_type_subclasses=self.ignore_type_subclasses,
                                      ignore_string_case=self.ignore_string_case,
                                      number_to_string_func=self.number_to_string,
                                      )
                item_hash = hashes_all[item]
            except Exception as e:  # pragma: no cover
                logger.warning("Can not produce a hash for %s."
                               "Not counting this object.\n %s" %
                               (level.path(), e))
            else:
                if item_hash is unprocessed:  # pragma: no cover
                    logger.warning("Item %s was not processed while hashing "
                                   "thus not counting this object." %
                                   level.path())
                else:
                    self._add_hash(hashes=hashes, item_hash=item_hash, item=item, i=i)
        return hashes
1083290
def create_hash(inp, l=10, algo="sha256"):
    
    return getattr(hashlib, algo)(six.b(str(inp))).hexdigest()[:l]
629083
private void expandAndRehash() {
    final int[] newHashSet = new int[hashSet.length * 2];
    final int bucketMask = (newHashSet.length - 1);

    for (int j = 0; j < hashSet.length; j++) {
      final int state = hashSet[j];
      if (state > 0) {
        int slot = hash(state, stateLength(state)) & bucketMask;
        for (int i = 0; newHashSet[slot] > 0;) {
          slot = (slot + (++i)) & bucketMask;
        }
        newHashSet[slot] = state;
      }
    }
    this.hashSet = newHashSet;
  }
1138125
function hash (str) {
  return crypto
    .createHash('sha1')
    .update(str, 'ascii')
    .digest('base64')
    .replace(PLUS_GLOBAL_REGEXP, '-')
    .replace(SLASH_GLOBAL_REGEXP, '_')
    .replace(EQUAL_GLOBAL_REGEXP, '')
}
1288769
private function hashHashable()
    {
        $hasher = new BcryptHasher;
        $filtered = array_filter($this->attributes);

        foreach ($filtered as $key => $value)
        {
            if (in_array($key, $this->hashable) && $value != $this->getOriginal($key))
            {
                $this->attributes[$key] = $hasher->make($value);
            }
        }
    }
143334
public static int[] createHashes(String str, int hashNumber) {
		int[] result = new int[hashNumber];
		for(int i = 0; i < hashNumber; i++) {
			result[i] = hash(str, i);
			
		}
		return result;
	}
1357122
function hash() {
	var i = 0,
		args = arguments,
		length = args.length,
		obj = {};
	for (; i < length; i++) {
		obj[args[i++]] = args[i];
	}
	return obj;
}
963768
def init_with_hash(hash)
      @tuple = Hash.new
      hash.each do |k, v|
        raise InvalidHashTupleKey unless String === k
        @tuple[k] = v
      end
    end