store as digests to save space
488924
private static String toDigest(String input) {
        md.reset();
        try {
            md.update(input.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
        }
        String result = com.ibm.ws.common.internal.encoder.Base64Coder.base64EncodeToString(md.digest());
        //String result = Base64.getEncoder().encodeToString(md.digest());  // java8 only
        return result;
    }
1372777
def available_digests(family=None, name=None):
		
		generators = WHash.available_generators(family=family, name=name)
		return set([WHash.generator(x).generator_digest_size() for x in generators])
477654
def digest(self,data=None):
        
        if data is not None:
            self.update(data)
        b=create_string_buffer(256)
        size=c_size_t(256)
        if libcrypto.EVP_DigestSignFinal(self.ctx,b,pointer(size))<=0:
            raise DigestError('SignFinal')
        self.digest_finalized=True
        return b.raw[:size.value]
342451
def generator_by_digest(family, digest_size):
		
		for generator_name in WHash.available_generators(family=family):
			generator = WHash.generator(generator_name)
			if generator.generator_digest_size() == digest_size:
				return generator
		raise ValueError('Hash generator is not available')
928384
def store(self, key, data):
        """"""
        if not os.path.exists(self._hash_dir):
            os.makedirs(self._hash_dir)

        if isinstance(data, pd.DataFrame):
            columns = data.columns.tolist()
            np.save(os.path.join(self._hash_dir, key), data.values)
            json.dump(columns, open(os.path.join(self._hash_dir, '%s.json' % key), 'w'))
        else:
            np.save(os.path.join(self._hash_dir, key), data)
213303
function digestFile(file, algorithm, encoding) {
    return crypto.createHash(algorithm || 'md5').update(fs.readFileSync(file)).digest(encoding || 'hex');
}
135760
def _store_object(self, obj_name, content, etag=None, chunked=False,
            chunk_size=None, headers=None):
        
        head_etag = headers.pop("ETag", "")
        if chunked:
            headers.pop("Content-Length", "")
            headers["Transfer-Encoding"] = "chunked"
        elif etag is None and content is not None:
            etag = utils.get_checksum(content)
        if etag:
            headers["ETag"] = etag
        if not headers.get("Content-Type"):
            headers["Content-Type"] = None
        uri = "/%s/%s" % (self.uri_base, obj_name)
        resp, resp_body = self.api.method_put(uri, data=content,
                headers=headers)
1354876
async def set_digest(self, dkey, value):
        
        node = Node(dkey)

        nearest = self.protocol.router.find_neighbors(node)
        if not nearest:
            log.warning("There are no known neighbors to set key %s",
                        dkey.hex())
            return False

        spider = NodeSpiderCrawl(self.protocol, node, nearest,
                                 self.ksize, self.alpha)
        nodes = await spider.find()
        log.info("setting '%s' on %s", dkey.hex(), list(map(str, nodes)))

        # if this node is close too, then store here as well
        biggest = max([n.distance_to(node) for n in nodes])
        if self.node.distance_to(node) < biggest:
            self.storage[dkey] = value
        results = [self.protocol.call_store(n, dkey, value) for n in nodes]
        # return true only if at least one store call succeeded
        return any(await asyncio.gather(*results))
15635
def update_digest

    path = self.bundle_dir
    sha = Digest::SHA2.new
    bundle_sha = Digest::SHA2.new

    digests = []
    Dir.glob("#{path}/**/*").sort.each do |f|
      next if File.directory?(f) || File.basename(f) == "digest" || f =~ /^#{path}\/test/
      bundle_sha.file(f)
      sha.reset()
      digests << { :file => f.gsub(/#{path}\//, ''), :digest => sha.file(f).hexdigest() }
    end

    @digest = { :digest => bundle_sha.hexdigest(), :files => digests }
    File.open(path+"/digest", 'w'){ |f|
      f.write(MultiJson.dump(@digest, :pretty => true, :adapter => :json_gem) + "\n")
    }

  end
1293751
def digest(self):
        '''
        
        '''

        return salt.utils.stringutils.to_str(self.__digest.hexdigest() + os.linesep)
1253872
def digest(self, **args):
        """"""
        return String(XML.canonicalized_string(self.root)).digest(**args)
606355
def _PartitionChunks(chunks):
  """"""
  partitions = [[]]
  partition_size = 0

  for chunk in chunks:
    cursize = len(chunk["blob_chunk"])
    if (cursize + partition_size > BLOB_CHUNK_SIZE or
        len(partitions[-1]) >= CHUNKS_PER_INSERT):
      partitions.append([])
      partition_size = 0
    partitions[-1].append(chunk)
    partition_size += cursize

  return partitions
364737
def digest(dirname, glob=None):
    
    md5 = hashlib.md5()
    if glob is None:
        fnames = [fname for _, fname in list_files(Path(dirname))]
        for fname in sorted(fnames):
            fname = os.path.join(dirname, fname)
            md5.update(open(fname, 'rb').read())
    else:
        fnames = Path(dirname).glob(glob)
        for fname in sorted(fnames):
            md5.update(fname.open('rb').read())
    return md5.hexdigest()
981392
def file_digest(path)
      if stat = self.stat(path)
        # Caveat: Digests are cached by the path's current mtime. Its possible
        # for a files contents to have changed and its mtime to have been
        # negligently reset thus appearing as if the file hasn't changed on
        # disk. Also, the mtime is only read to the nearest second. It's
        # also possible the file was updated more than once in a given second.
        key = UnloadedAsset.new(path, self).file_digest_key(stat.mtime.to_i)
        cache.fetch(key) do
          self.stat_digest(path, stat)
        end
      end
    end
944108
function parseDigest(digest) {
    if (!digest)
        return false;
    // protect against missing data
    var needed_parts = {"nonce": 1, "nc": 1, "cnonce": 1, "qop": 1,
        "username": 1, "uri": 1, "response": 1};
    var data = {};

    digest.replace(/(\w+)=(?:(?:")([^"]+)"|([^\s,]+))/g, function(m, m1, m2, m3) {
        data[m1] = m2 ? m2 : m3;
        delete needed_parts[m1];
        return m;
    });

    return Object.keys(needed_parts).length ? false : data;
}
1091358
private void digestPart() {
        if ( byteOffset >= MB ) {
            byteOffset = 0;
            checksums.add(digestInputStream.getMessageDigest().digest());
            digestInputStream.getMessageDigest().reset();
        }
    }
96550
def stash(self, storage, url):
        """"""
        result = {}
        if self.is_valid():
            upload = self.cleaned_data['upload']
            name = storage.save(upload.name, upload)
            result['filename'] = os.path.basename(name)
            try:
                result['url'] = storage.url(name)
            except NotImplementedError:
                result['url'] = None
            result['stored'] = serialize_upload(name, storage, url)
        return result