A listener that computes the Content-MD5 and sets it in the header.
@see AWS.S3.willComputeChecksums
@api private
355193
function computeContentMd5(req) {
    if (req.service.willComputeChecksums(req)) {
      var md5 = AWS.util.crypto.md5(req.httpRequest.body, 'base64');
      req.httpRequest.headers['Content-MD5'] = md5;
    }
  }
1311372
public static String hexMD5(String value) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            messageDigest.reset();
            messageDigest.update(value.getBytes("utf-8"));
            byte[] digest = messageDigest.digest();
            return byteToHexString(digest);
        } catch (Exception ex) {
            throw new UnexpectedException(ex);
        }
    }
1103653
function computeChecksum(filename) {
	var contents = fs.readFileSync(filename);

	var hash = crypto
		.createHash('md5')
		.update(contents)
		.digest('base64')
		.replace(/=+$/, '');

	return hash;
}
155781
public static byte[] computeMD5Hash(InputStream is) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(is);
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            byte[] buffer = new byte[SIXTEEN_K];
            int bytesRead;
            while ( (bytesRead = bis.read(buffer, 0, buffer.length)) != -1 ) {
                messageDigest.update(buffer, 0, bytesRead);
            }
            return messageDigest.digest();
        } catch (NoSuchAlgorithmException e) {
            // should never get here
            throw new IllegalStateException(e);
        } finally {
            try {
                bis.close();
            } catch (Exception e) {
                LogFactory.getLog(Md5Utils.class).debug(
                        "Unable to close input stream of hash candidate: " + e);
            }
        }
    }
1082837
function MD5(source) { // @arg String - source string
                       // @ret MD5HashHexString
//{@dev
    $valid($type(source, "String"), MD5, "source");
//}@dev

    var md5 = DataType["Array"]["toHexStringArray"](
                    MD5_encode(
                        DataType["Uint8Array"]["fromString"](source) ) );

    return md5.join("");
}
209085
public void setChecksum(final String checksum) {
        if (checksum == null && this.checksum == null) {
            return;
        } else if (checksum == null) {
            removeChild(this.checksum);
            this.checksum = null;
        } else if (this.checksum == null) {
            this.checksum = new KeyValueNode<String>(CommonConstants.CS_CHECKSUM_TITLE, checksum);
            appendChild(this.checksum, false);
        } else {
            this.checksum.setValue(checksum);
        }
    }
595251
function md5 (obj) {
    var md5sum = CRYPTO.createHash('md5');
    obj = typeof obj === 'string' ? obj : JSON.stringify(obj);
    md5sum.update(obj);
    return md5sum.digest('hex');
}
33406
private static String calculateMessageBodyMd5(String messageBody) {
        if (log.isDebugEnabled()) {
            log.debug("Message body: " + messageBody);
        }
        byte[] expectedMd5;
        try {
            expectedMd5 = Md5Utils.computeMD5Hash(messageBody.getBytes(UTF8));
        } catch (Exception e) {
            throw new AmazonClientException("Unable to calculate the MD5 hash of the message body. " + e.getMessage(),
                    e);
        }
        String expectedMd5Hex = BinaryUtils.toHex(expectedMd5);
        if (log.isDebugEnabled()) {
            log.debug("Expected  MD5 of message body: " + expectedMd5Hex);
        }
        return expectedMd5Hex;
    }
706215
function md5Hash(buf) {
  var md5 = crypto.createHash('md5');
  md5.update(buf);
  return md5.digest('hex');
}
1353190
protected function computeContentMd5(HttpRequest $request)
	{
		if(!$request->hasEntity())
		{
			return md5('');
		}
		
		$hash = hash_init('md5');
		$in = $request->getEntity()->getInputStream();
		
		$tmp = new \SplTempFileObject();
		$fp = $tmp->openFile('wb', false);
		
		try
		{
			flock($fp, LOCK_EX);
		
			while(false !== ($chunk = $in->read()))
			{
				hash_update($hash, $chunk);
				fwrite($fp, $chunk);
			}
		}
		finally
		{
			@fclose($fp);
		}
		
		$request->setEntity(new StreamEntity($tmp->openFile('rb', false)));
	
		return hash_final($hash);
	}
482175
public static String encryptToMD5(String info) {
		byte[] digesta = null;
		try {
			MessageDigest alga = MessageDigest.getInstance("MD5");
			alga.update(info.getBytes());
			digesta = alga.digest();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		// to string
		return byte2hex(digesta);
	}
792374
public static byte[] md5(InputStream in) throws IOException {
		MD5InputStream md5in=new MD5InputStream(in);
		byte[] trashBuffer = BufferManager.getBytes();
		try {
			while(md5in.read(trashBuffer, 0, BufferManager.BUFFER_SIZE) != -1) {
				// Intentional empty block
			}
		} finally {
			BufferManager.release(trashBuffer, false);
		}
		return md5in.hash();
	}
234559
public static String toMD5hash(final String s) {

        String hash = null;
        if (null != s) {
            try {
                final MessageDigest digest = MessageDigest.getInstance("MD5");
                digest.update(s.getBytes(Charset.forName("utf-8")));
                final byte[] md5sum = digest.digest();
                final BigInteger bigInt = new BigInteger(1, md5sum);
                hash = bigInt.toString(16);
            } catch (final NoSuchAlgorithmException e) {
                throw new RuntimeException("MD5 digest algorithm implementation not found", e);
            }
        }
        return hash;
    }
554992
public static String md5sum(InputStream input) throws IOException {
        InputStream in = new BufferedInputStream(input);
        try {
            MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
            DigestInputStream digestInputStream = new DigestInputStream(in, digest);
            while(digestInputStream.read() >= 0) {
            }
            OutputStream md5out = new ByteArrayOutputStream();
            md5out.write(digest.digest());
            return md5out.toString();
        }
        catch(NoSuchAlgorithmException e) {
            throw new IllegalStateException("MD5 algorithm is not available: " + e.getMessage());
        }
        finally {
            in.close();
        }
    }
1076003
@Override
    public synchronized byte[] createMd5Checksum(final byte[] in)
    {
        digest.reset();

        digest.update(in);

        byte[] bytes = digest.digest();

        return bytes;
    }
154799
public static String getMD5Hash(final String input) throws HibiscusException  {

        String hashValue = null;

        try {

            final MessageDigest messageDigest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM_MD5);
            byte[] md5Hash = new byte[BYTE_LENGTH_MD5];

            messageDigest.update(input.getBytes(ENCODING_CHARSET_NAME), MESSAGE_DIGEST_UPDATE_OFFSET, input.length());
            md5Hash = messageDigest.digest();

            hashValue = convertToHex(md5Hash);

        } catch (NoSuchAlgorithmException e) {
            throw new HibiscusException("Unsupported Message Digest Algorithm "  + MESSAGE_DIGEST_ALGORITHM_MD5, e);
        } catch (UnsupportedEncodingException e) {
            throw new HibiscusException("Unsupported Encoding " + ENCODING_CHARSET_NAME , e);
        }

        return hashValue;
    }
100151
def md5sum(content):
    '''
    '''
    md5 = hashlib.md5()
    md5.update(force_bytes(content))
    return md5.hexdigest()