sha256 checksum, thanks to: https://gist.github.com/rji/b38c7238128edf53a181
510201
def _checksum(in_file, block_size=65536):
    
    cs = hashlib.sha256()
    with open(in_file, "rb") as f:
        for block in iter(lambda: f.read(block_size), b''):
            cs.update(block)
    return cs.hexdigest()
570602
function hash256(data) {
  const out = Buffer.allocUnsafe(32);
  ctx.init();
  ctx.update(data);
  ctx._finish(out);
  ctx.init();
  ctx.update(out);
  ctx._finish(out);
  return out;
}
582279
function md5Salt(value, salt = 'abcdefghijklmnopqrstuvwxyz1234567890') {
    let ins = crypto.createHash('md5');
    value = value + salt.slice(value.length % salt.length, salt.length);
    ins.update(value);    
    return ins.digest('hex');
}
148119
def secure_compare(a, b)
      fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
    end
418242
private void calculateChecksums(File file) {
        try {
            this.md5sum = Checksum.getMD5Checksum(file);
            this.sha1sum = Checksum.getSHA1Checksum(file);
            this.sha256sum = Checksum.getSHA256Checksum(file);
        } catch (NoSuchAlgorithmException | IOException ex) {
            LOGGER.debug(String.format("Unable to calculate checksums on %s", file), ex);
        }
    }
527220
def sha_hash(self) -> str:
        
        return hashlib.sha256(self.signed_raw().encode("ascii")).hexdigest().upper()
911368
def hmac_sha256(key, msg):
    

    return hmac.new(key, msg, hashlib.sha256).digest()
1030498
def md5_checksum(file_path, chunk_bytes=4194304):
    """"""

    with open(file_path, "rb") as infile:
        checksum = hashlib.md5()
        while 1:
            data = infile.read(chunk_bytes)
            if not data:
                break
            checksum.update(data)

    return checksum.hexdigest()
684625
def get_checksum(self, encoder=base64.b64encode, hasher=hashlib.sha256):
        """"""
        assert self._closed, "Archive not closed"
        with open(self._temp_archive_file.name, 'rb') as fh:
            return encoder(checksum(fh, hasher())).decode('ascii')
160487
function checksum(str) {
    crcTbl = crcTbl || makeCRCTable();

    /* jslint bitwise: true */
    var crc = 0 ^ (-1);

    for (var i = 0; i < str.length; i++) {
        crc = (crc >>> 8) ^ crcTbl[(crc ^ str.charCodeAt(i)) & 0xFF];
    }

    return (crc ^ (-1)) >>> 0;
}
1327491
function c32checksum(dataHex: string) : string {
  const tmpHash = crypto.createHash('sha256').update(Buffer.from(dataHex, 'hex')).digest()
  const dataHash = crypto.createHash('sha256').update(tmpHash).digest()
  const checksum = dataHash.slice(0, 4).toString('hex')
  return checksum
}
27066
function httpGetChecksum (algorithm, url) {
  if (arguments.length === 1) {
    url = algorithm;
    algorithm = 'sha1';
  }
  var deferred = Q.defer();
  var http;
  if (url.slice(0, 5) === 'https') {
    http = require('https');
  } else if (url.slice(0, 4) === 'http')  {
    http = require('http');
  } else {
    deferred.resolve('[ERROR] Unknown protocol.');
    return deferred.promise;
  }
  var parts = Url.parse(url);
  http.get({
    host: parts.hostname,
    port: parts.port,
    path: parts.pathname,
    agent: false
  }, function(res) {
    var code = res.statusCode;
    if (code === 301 || code === 302) {
      return deferred.resolve(httpGetChecksum(algorithm, res.headers.location));
    } else if (code !== 200) {
      return deferred.resolve('[ERROR] Fail to get the page. Status: ' + code);
    }
    var sum = crypto.createHash(algorithm);
    res.on('data', function(data) {
      sum.update(data);
    });
    res.on('end', function() {
      deferred.resolve(sum.digest('hex'));
    });
  }).on('error', function (e) {
    deferred.resolve('[ERROR] ' + e.toString());
  });
  return deferred.promise;
}
775938
def sha256_fingerprint_from_raw_ssh_pub_key(raw_key):
    
    digest = hashlib.sha256(raw_key).digest()
    h = base64.b64encode(digest).decode('utf-8')
    h = h.rstrip().rstrip('=')  # drop newline and possible base64 padding
    return 'SHA256:' + h
962545
def hash256(msg_bytes):
    '''
    
    '''
    if 'decred' in riemann.get_current_network_name():
        return blake256(blake256(msg_bytes))
    return hashlib.sha256(hashlib.sha256(msg_bytes).digest()).digest()
1135743
function validateChecksum(fileName, checksum, cb) {
   if (isUndefined(checksum) || isUndefined(checksum.hashAlgorithm)) {
      cb();
      return;
   }

   if (isUndefined(checksum.inline) || isUndefined(checksum.inline.value)) {
      cb(new Error('Installed jobs agent only supports inline checksum value provided in job document'));
      return;
   }

   var hash;
   try {
      hash = crypto.createHash(checksum.hashAlgorithm);
   } catch (err) {
      cb(new Error('Unsupported checksum hash algorithm: ' + checksum.hashAlgorithm));
      return;
   }

   var stream = fs.createReadStream(fileName);

   stream.on('data', function (data) {
      hash.update(data, 'utf8');
   }).on('end', function () {
      if (hash.digest('hex') !== checksum.inline.value) {
         var err = new Error('Checksum mismatch');
         err.fileName = fileName;
         cb(err);
      } else {
         cb();
      }
   }).on('error', function (err) {
      err.fileName = fileName;
      cb(err);
   });
}
190839
def checksum(path):
    """"""
    hasher = hashlib.sha1()
    with open(path, 'rb') as stream:
        buf = stream.read(BLOCKSIZE)
        while len(buf) > 0:
            hasher.update(buf)
            buf = stream.read(BLOCKSIZE)
    return hasher.hexdigest()
702078
def check_sha(self, sha, content):
        
        rightful_sha = sha256(bytes("{}{}".format(content, self.secret), "utf-8")).hexdigest()
        return sha == rightful_sha