Calculates the MD5 hash of the string.

@param text
@return md5 hash of the string
485479
public static String getHashMD5(String text) {
        byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1);
        return getHashMD5(bytes);
    }
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;
    }
329792
public static String getMD5String(String str) {
        MessageDigest messageDigest = getMessageDigest(MD5);
        return getHashString(str, messageDigest);
    }
1258138
@Override
    public byte[] md5(String toHash) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance(Hash.MD5.toString());
            messageDigest.reset();
            messageDigest.update(toHash.getBytes(UTF_8));
            return messageDigest.digest();
        } catch (NoSuchAlgorithmException e) {
            // Should not happen as every JVM must support D5, SHA-1 and SHA-256.
            throw new RuntimeException(e);
        }
    }
1084428
public static String getSHA256Checksum(String text) {
        final byte[] data = stringToBytes(text);
        return getChecksum(SHA256, data);
    }
728773
@Override
    public String encode( String text ) {
        try {
            byte[] hash = SecureHash.getHash(algorithm, text.getBytes());
            String result = Base64.encodeBytes(hash);
            return result.length() < maxLength ? result : result.substring(0, maxLength);
        } catch (NoSuchAlgorithmException e) {
            return text;
        }
    }
764060
public static long hash64(final String text, int from, int length) {
        return hash64(text.substring( from, from+length));
    }
825908
public static String getHashMD5(byte[] bytes) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(bytes, 0, bytes.length);
            byte[] digest = md.digest();
            return toHex(digest);
        } catch (NoSuchAlgorithmException t) {
            throw new RuntimeException(t);
        }
    }
1257599
public static String MD5(String plainText) throws NoSuchAlgorithmException {
        // 创建一个md5算法对象
        MessageDigest md = MessageDigest.getInstance(EncryptionType.MD5);
        byte[] messageByte = plainText.getBytes();
        // 获得MD5字节数组,16*8=128位
        byte[] md5Byte = md.digest(messageByte);
        // 转换为16进制字符串

        StringBuilder sb = new StringBuilder();
        // 把每一个byte 做一个与运算 0xff;
        for (byte b : md5Byte) {
            // 与运算
            int number = b & 0xff;// 加盐
            String str = Integer.toHexString(number);
            if (str.length() == 1) {
                sb.append("0");
            }
            sb.append(str);
        }
        //32位加密
        return sb.toString();
    }
100151
def md5sum(content):
    '''
    '''
    md5 = hashlib.md5()
    md5.update(force_bytes(content))
    return md5.hexdigest()
684039
static String hashMD5(String s) throws ApiDataException {
        MessageDigest algorithm = null;
        try {
            algorithm = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException nsae) {
            throw new ApiDataException("Cannot find MD5 digest algorithm");
        }
        byte[] defaultBytes = new byte[s.length()];
        for (int i = 0; i < s.length(); i++) {
            defaultBytes[i] = (byte) (0xFF & s.charAt(i));
        }
        algorithm.reset();
        algorithm.update(defaultBytes);
        byte messageDigest[] = algorithm.digest();
        StringBuilder hexString = new StringBuilder();
        for (int i = 0; i < messageDigest.length; i++) {
            String hex = Integer.toHexString(0xFF & messageDigest[i]);
            if (hex.length() == 1) {
                hexString.append('0');
            }
            hexString.append(hex);
        }
        return hexString.toString();
    }
1016643
public static String generateShaHash(String text) {
		try {
			MessageDigest digest = MessageDigest.getInstance(SHA_ALGORITHM);
			byte[] bytes = text.getBytes(UTF_8);
			bytes = digest.digest(bytes);
			return toHexEncode(bytes);
		} catch (Exception e) {
			throw new UnexpectedException(e);
		}
	}
1004711
static String getMd5Hash(byte[] bytes) throws NoSuchAlgorithmException {

        String hash;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(bytes);
            byte[] digest = md.digest();

            char[] hexCode = "0123456789ABCDEF".toCharArray();
            StringBuilder r = new StringBuilder(digest.length * 2);
            for (byte b : digest) {
                r.append(hexCode[(b >> 4) & 0xF]);
                r.append(hexCode[(b & 0xF)]);
            }

            hash = r.toString().toUpperCase();
        }catch (NoSuchAlgorithmException e){
            throw e;
        }
        return hash;
    }
1534
def md5(source):
    
    # fix passing char '+' from source
    source = source.replace("%2B", "+")
    with open(source) as file_to_check:
        data = file_to_check.read()
        return hashlib.md5(data).hexdigest()
1297299
public static function passwordHash(string $text): ?string
    {
        return password_hash($text, self::PASSWORD_CRYPT_ALGO, [
            'cost' => self::PASSWORD_CRYPT_COST
        ]);
    }
1341938
public static String getSHA1Checksum(String text) {
        final byte[] data = stringToBytes(text);
        return getChecksum(SHA1, data);
    }
762235
public static String md5Encrypt(String str) {
		byte[] bytes = null;
		try {
			bytes = str.getBytes("UTF-8");
		} catch (Exception e) {
			bytes = str.getBytes();
		}

		byte messageDigest[] = null;
		synchronized (m_md5) {
			m_md5.update(bytes);
			messageDigest = m_md5.digest();
		}

		StringBuffer hexString = new StringBuffer();
		int d;
		for (int i = 0; i < messageDigest.length; i++) {
			d = messageDigest[i];
			if (d < 0)
				d += 256;
			if (d < 16)
				hexString.append("0");
			hexString.append(Integer.toHexString(d));
		}
		return hexString.toString();
	}