Calculates HMAC-MD5
960282
static byte[] hmacMD5(final byte[] value, final byte[] key)
        throws AuthenticationException {
        final HMACMD5 hmacMD5 = new HMACMD5(key);
        hmacMD5.update(value);
        return hmacMD5.getOutput();
    }
617919
function calc_md5_response($trans_id = '', $amount = '') {
    if ($amount == '' || $amount == '0') $amount = '0.00';
    $validating = md5(MODULE_PAYMENT_AUTHORIZENET_ECHECK_MD5HASH . MODULE_PAYMENT_AUTHORIZENET_ECHECK_LOGIN . $trans_id . $amount);
    return strtoupper($validating);
  }
1175358
private int hmacSignature(byte[] workBytes) {
    try {
      Mac integrityHmac = createMac();
      integrityHmac.init(keys.getIntegrityKey());
      integrityHmac.update(workBytes, PAYLOAD_BASE, workBytes.length - OVERHEAD_SIZE);
      integrityHmac.update(workBytes, INITV_BASE, INITV_SIZE);
      return Ints.fromByteArray(integrityHmac.doFinal());
    } catch (InvalidKeyException e) {
      throw new IllegalStateException(e);
    }
  }
357528
function md5(files) {
		var hash = crypto.createHash('md5');
		_.each(files, function(file) {
			if (!isExternal(file))
				hash.update(grunt.file.read(file), 'utf-8');
		});
    	return hash.digest('hex');
	}
1306793
function rstr_hmac(key, data) {
        var bkey, ipad, opad, hash, i;

        key = (utf8) ? utf8Encode(key) : key;
        data = (utf8) ? utf8Encode(data) : data;
        bkey = rstr2binl(key);
        if (bkey.length > 16) {
          bkey = binl(bkey, key.length * 8);
        }

        ipad = Array(16), opad = Array(16);
        for (i = 0; i < 16; i += 1) {
          ipad[i] = bkey[i] ^ 0x36363636;
          opad[i] = bkey[i] ^ 0x5C5C5C5C;
        }
        hash = binl(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
        return binl2rstr(binl(opad.concat(hash), 512 + 128));
      }
464770
def calculate_md5(fileobject, size=2**16):
    """"""
    fileobject.seek(0)
    md5 = hashlib.md5()
    for data in iter(lambda: fileobject.read(size), b''):
        if not data: break
        if isinstance(data, six.text_type):
            data = data.encode('utf-8') # md5 needs a byte string
        md5.update(data)
    fileobject.seek(0) # rewind read head
    return md5.hexdigest()
706215
function md5Hash(buf) {
  var md5 = crypto.createHash('md5');
  md5.update(buf);
  return md5.digest('hex');
}
757403
def get_file_md5sum(path):
    """"""
    with open(path, 'rb') as fh:
        h = str(hashlib.md5(fh.read()).hexdigest())
    return h
10922
def md5(self):
        
        hash_ = hashlib.md5()
        with self.open("rb") as inf:
            block = inf.read(4096)
            while block:
                hash_.update(block)
                block = inf.read(4096)

        return hash_.hexdigest()
772087
def MD5Hash(password):
    
    md5_password = md5.new(password)
    password_md5 = md5_password.hexdigest()
    return password_md5
642064
protected DataHash calculateMac() throws KSIException {
        try {
            HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
            algorithm.checkExpiration();
            return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
        } catch (IOException e) {
            throw new KSIProtocolException("Problem with HMAC", e);
        } catch (InvalidKeyException e) {
            throw new KSIProtocolException("Problem with HMAC key.", e);
        } catch (NoSuchAlgorithmException e) {
            // If the default algorithm changes to be outside of MD5 / SHA1 /
            // SHA256 list.
            throw new KSIProtocolException("Unsupported HMAC algorithm.", e);
        } catch (HashException e) {
            throw new KSIProtocolException(e.getMessage(), e);
        }
    }
804894
def decrypt(self, data):
        '''
        
        '''
        aes_key, hmac_key = self.keys
        sig = data[-self.SIG_SIZE:]
        data = data[:-self.SIG_SIZE]
        if six.PY3 and not isinstance(data, bytes):
            data = salt.utils.stringutils.to_bytes(data)
        mac_bytes = hmac.new(hmac_key, data, hashlib.sha256).digest()
        if len(mac_bytes) != len(sig):
            log.debug('Failed to authenticate message')
            raise AuthenticationError('message authentication failed')
        result = 0

        if six.PY2:
            for zipped_x, zipped_y in zip(mac_bytes, sig):
                result |= ord(zipped_x) ^ ord(zipped_y)
        else:
            for zipped_x, zipped_y in zip(mac_bytes, sig):
                result |= zipped_x ^ zipped_y
        if result != 0:
            log.debug('Failed to authenticate message')
            raise AuthenticationError('message authentication failed')
        iv_bytes = data[:self.AES_BLOCK_SIZE]
        data = data[self.AES_BLOCK_SIZE:]
        if HAS_M2:
            cypher = EVP.Cipher(alg='aes_192_cbc', key=aes_key, iv=iv_bytes, op=0, padding=False)
            encr = cypher.update(data)
            data = encr + cypher.final()
        else:
            cypher = AES.new(aes_key, AES.MODE_CBC, iv_bytes)
            data = cypher.decrypt(data)
        if six.PY2:
            return data[:-ord(data[-1])]
        else:
            return data[:-data[-1]]
405307
private static function hmacFallbackMD5($data, $secret) {
    $b = 64; // byte length for md5

    if (strlen($secret) > $b) {
      $secret = pack("H*", md5($secret));
    }

    $secret = str_pad($secret, $b, chr(0x00));
    $ipad = str_pad('', $b, chr(0x36));
    $opad = str_pad('', $b, chr(0x5c));
    $k_ipad = $secret ^ $ipad;
    $k_opad = $secret ^ $opad;

    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
  }
1349954
function calc_md5_response($trans_id = '', $amount = '') {
    if ($amount == '' || $amount == '0') $amount = '0.00';
    $validating = md5(MODULE_PAYMENT_AUTHORIZENET_MD5HASH . MODULE_PAYMENT_AUTHORIZENET_LOGIN . $trans_id . $amount);
    return strtoupper($validating);
  }
442616
def _calc_key(auth_key, msg_key, client):
        
        x = 0 if client else 8
        sha256a = sha256(msg_key + auth_key[x: x + 36]).digest()
        sha256b = sha256(auth_key[x + 40:x + 76] + msg_key).digest()

        aes_key = sha256a[:8] + sha256b[8:24] + sha256a[24:32]
        aes_iv = sha256b[:8] + sha256a[8:24] + sha256b[24:32]

        return aes_key, aes_iv
1181128
def generate_k(order, secexp, hash_func, data):
    '''
        
    '''

    qlen = bit_length(order)
    holen = hash_func().digest_size
    rolen = (qlen + 7) / 8
    bx = number_to_string(secexp, order) + bits2octets(data, order)

    # Step B
    v = b('\x01') * holen

    # Step C
    k = b('\x00') * holen

    # Step D

    k = hmac.new(k, v+b('\x00')+bx, hash_func).digest()

    # Step E
    v = hmac.new(k, v, hash_func).digest()

    # Step F
    k = hmac.new(k, v+b('\x01')+bx, hash_func).digest()

    # Step G
    v = hmac.new(k, v, hash_func).digest()

    # Step H
    while True:
        # Step H1
        t = b('')

        # Step H2
        while len(t) < rolen:
            v = hmac.new(k, v, hash_func).digest()
            t += v

        # Step H3
        secret = bits2int(t, qlen)

        if secret >= 1 and secret < order:
            return secret

        k = hmac.new(k, v+b('\x00'), hash_func).digest()
        v = hmac.new(k, v, hash_func).digest()
685333
def md5sum(fname: str) -> str:
    """"""
    with open(fname, "rb") as inp:
        md5 = hashlib.md5(inp.read()).hexdigest()
    return md5