Calculate MD5 hash of a String

@param str - the String to hash
@return the MD5 hash value
329792
public static String getMD5String(String str) {
        MessageDigest messageDigest = getMessageDigest(MD5);
        return getHashString(str, messageDigest);
    }
33789
public static String MD5EncodeToNum(String str) {
		String reStr = null;
		try {
			reStr = new String(str);
			MessageDigest md = MessageDigest.getInstance("MD5");
			reStr = byteArrayToNumString(md.digest(reStr.getBytes()));
		} catch (Exception e) {
		}
		return reStr;
	}
516687
public String sha256Hex(String str) {
        byte[] a = DigestUtils.sha256(str);
        StringBuilder sb = new StringBuilder(a.length * 2);
        for(byte b: a)
            sb.append(String.format("%02x", b));
        return sb.toString();
    }
699325
private String sha512hash(String str) {
        return Hashing.sha512().hashBytes(str.getBytes(getEncoding())).toString();
    }
837134
public static int apHash(String str) {
		int hash = 0;

		for (int i = 0; i < str.length(); i++) {
			hash ^= ((i & 1) == 0) ? ((hash << 7) ^ str.charAt(i) ^ (hash >> 3)) : (~((hash << 11) ^ str.charAt(i) ^ (hash >> 5)));
		}

		// return (hash & 0x7FFFFFFF);
		return hash;
	}
30999
public static String getMD5Checksum(String str, Charset charset) throws IOException {

		InputStream is = new ByteArrayInputStream(str.getBytes(charset.name()));
		return getMD5Checksum(is);
	}
695886
public static int djbHash(String str) {
		int hash = 5381;

		for (int i = 0; i < str.length(); i++) {
			hash = ((hash << 5) + hash) + str.charAt(i);
		}

		return hash & 0x7FFFFFFF;
	}
1024559
def md5(value):
    
    m = hashlib.md5()
    m.update(value)
    return str(m.hexdigest())
1063350
func Md5(str string) string {
	m := md5.New()
	io.WriteString(m, str)
	return fmt.Sprintf("%x", m.Sum(nil))
}
772087
def MD5Hash(password):
    
    md5_password = md5.new(password)
    password_md5 = md5_password.hexdigest()
    return password_md5
850349
public static int sdbmHash(String str) {
		int hash = 0;

		for (int i = 0; i < str.length(); i++) {
			hash = str.charAt(i) + (hash << 6) + (hash << 16) - hash;
		}

		return hash & 0x7FFFFFFF;
	}
1001915
private static function hash($str)
    {
        $hash = 0;
        $str = str_split($str, 1);
        foreach ($str as $char) {
            $hash = ($hash << 4) + ord($char);
            $g = $hash & (0xf << (self::INT_SIZE - 4));
            if ($g !== 0) {
                $hash = $hash ^ ($g >> self::INT_SIZE - 8);
                $hash = $hash ^ $g;
            }
        }
        return $hash;
    }
708167
public static byte[] md5Bytes(String str) {
        if (str == null) return null;
        MessageDigest md5;
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException ex) {
            throw new RuntimeException(ex);
        }
        return md5.digest(str.getBytes());
    }
671779
function md5Hash(val) {
        if (!val) { return val; }

        var str = _.isObject(val) ? JSON.stringify(val) : val;
        var md5 = crypto.createHash('md5');
        md5.update(str);
        return md5.digest('hex');
    }
532942
public static String getMD5Checksum(String str) throws IOException {

		InputStream is = new ByteArrayInputStream(str.getBytes());
		return getMD5Checksum(is);
	}
1191767
function md5_16($string)
    {
        $tmp = md5($string);
        $out = '';
        for ($i = 0; $i <= 30; $i = $i + 2) {
            $out .= chr(hexdec(substr($tmp, $i, 2)));
        }

        return $out;
    }
1063285
def md5sum( string ):
    
    h = hashlib.new( 'md5' )
    h.update( string.encode( 'utf-8' ) )
    return h.hexdigest()