Generates the MD5 checksum for the specified message.

@param message The message.
@return The hexadecimal checksum.
962995
public static String md5(final String message) {
        byte[] res;

        try {
            MessageDigest instance = MessageDigest.getInstance("MD5");
            instance.reset();
            instance.update(message.getBytes());
            res = instance.digest();

        } catch (final NoSuchAlgorithmException ex) {
            throw new RuntimeException(ex);
        }

        StringBuilder hexString = new StringBuilder();
        for (byte resByte : res) {
            hexString.append(Integer.toString((resByte & 0xff) + 0x100, 16).substring(1));
        }

        return hexString.toString();
    }
444231
static String md5(String origin) {
    try {
      MessageDigest md = MessageDigest.getInstance("MD5");
      md.update(origin.getBytes("UTF-8"));
      BigInteger bi = new BigInteger(1, md.digest());
      StringBuilder hash = new StringBuilder(bi.toString(16));

      while (hash.length() < 32) {
        hash.insert(0, "0");
      }

      return hash.toString();
    } catch (Exception e) {
      return getUuid();
    }
  }
276579
public static String md5Hex(final String input) {
		if (input == null) {
			throw new NullPointerException("String is null");
		}

    	MessageDigest digest = null;
    	
    	try {
    		digest = MessageDigest.getInstance("MD5");
    	} catch (NoSuchAlgorithmException e) {
    		// this should never happen
    		throw new RuntimeException(e);
    	}
        
        byte[] hash = digest.digest(input.getBytes());
        
        return DatatypeConverter.printHexBinary(hash);
    }
1058634
public static String encode(String message, int offset, boolean isEnocdeNumber) {
		final int len = message.length();
		final char[] chars = new char[len];

		for (int i = 0; i < len; i++) {
			chars[i] = encodeChar(message.charAt(i), offset, isEnocdeNumber);
		}
		return new String(chars);
	}
763391
public static String md5(String s) {
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            byte[] digest = md5.digest(s.getBytes(Charset.forName("UTF-8")));
            StringBuilder buf = new StringBuilder(2 * digest.length);
            for (byte oneByte : digest) {
                buf.append(Integer.toHexString((oneByte & 0xFF) | 0x100).substring(1, 3));
            }
            return buf.toString();
        } catch (NoSuchAlgorithmException ignore) { }
        return s;
    }
538534
def get_md5(string):
    """"""
    try:
        hasher = hashlib.md5()
    except BaseException:
        hasher = hashlib.new('md5', usedForSecurity=False)
    hasher.update(string)
    return hasher.hexdigest()
918354
public function decryptMessage($message)
    {
        $calgo = $this->config->getCipherAlgorithm();
        $cmode = $this->config->getCipherMode();
        $malgo = $this->config->getHmacAlgorithm();
        
        $size = mcrypt_get_iv_size($calgo, $cmode);
        $keySize = mcrypt_get_key_size($calgo, $cmode);
        $hmacSize = strlen(hash_hmac($malgo, '', 'foo-key', true));

        $cmac = substr($message, -1 * $hmacSize);
        $iv = substr($message, 0, $size);
        $cipherText = substr($message, $size, -1 * $hmacSize);
        $hmac = hash_hmac($malgo, $iv . $cipherText, $this->computeCipherKey($this->config->getHmacKey(), $hmacSize, $iv), true);
        
        if(!SecurityUtil::timingSafeEquals($hmac, $cmac))
        {
            throw new IntegrityCheckFailedException('Invalid encrypted input message detected');
        }
        
        $key = $this->computeCipherKey($this->config->getCipherKey(), $keySize, $iv);
        $data = mcrypt_decrypt($calgo, $key, $cipherText, $cmode, $iv);
        
        // PKCS7 Padding
        $pad = ord($data[strlen($data) - 1]);
        $data = substr($data, 0, -1 * $pad);
        
        // Remove zero-byte padding from the string.
        return $data;
    }
1076003
@Override
    public synchronized byte[] createMd5Checksum(final byte[] in)
    {
        digest.reset();

        digest.update(in);

        byte[] bytes = digest.digest();

        return bytes;
    }
476052
public String digest(String message) {
		final byte[] messageAsByteArray;

		try {
			messageAsByteArray = message.getBytes(charsetName);
		} catch (UnsupportedEncodingException e) {
			throw new DigestException("error converting message to byte array: charsetName=" + charsetName, e);
		}

		final byte[] digest = digest(messageAsByteArray);

		switch (outputMode) {
			case BASE64:
				return Base64.encodeBase64String(digest);
			case HEX:
				return Hex.encodeHexString(digest);
			default:
				return null;
		}
	}
801570
public static byte[] calculateSignature(byte[] random, byte[] privateKey, byte[] message) {
        byte[] result = new byte[64];

        if (curve_sigs.curve25519_sign(SHA512Provider, result, privateKey, message, message.length, random) != 0) {
            throw new IllegalArgumentException("Message exceeds max length!");
        }

        return result;
    }
906115
public static String generateMD5(final String input) {
        try {
            return generateMD5(input.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            LOG.debug("An error occurred generating the MD5 Hash of the input string", e);
            return null;
        }
    }
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()
644995
@Override
    public String hexMD5(String value) {
        return String.valueOf(Hex.encodeHex(md5(value)));
    }
755035
public static String getMD5Checksum(Resource res) throws Exception {
	byte[] b = createChecksum(res);
	String result = "";
	for (int i = 0; i < b.length; i++) {
	    result += Integer.toString((b[i] & 0xff) + 0x100, 16).substring(1);
	}
	return result;
    }
1100957
public static String getChecksum(String algorithm, byte[] bytes) {
        final MessageDigest digest = getMessageDigest(algorithm);
        final byte[] b = digest.digest(bytes);
        return getHex(b);
    }
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();
        }
    }
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);
        }
    }