MD5

@param str
@return
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();
	}
102075
public static String md5Hex(String data, String charset) {
		return new MD5().digestHex(data, charset);
	}
998241
def md5(self):
        """"""
        md5 = self.meta.get("md5")
        if md5 is None:
            md5 = str(hashlib.md5(self.value).hexdigest())

        return md5
735726
def textMD5(text):
    ''''''
    m = hash_md5()
    if isinstance(text, str):
        m.update(text.encode())
    else:
        m.update(text)
    return m.hexdigest()
882802
public static String MD5Encode(String origin) {
		String resultString = null;
		try {
			resultString = origin;
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(resultString.getBytes("UTF-8"));
			resultString = byteArrayToHexString(md.digest());
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		return resultString;
	}
1142362
public static function hash($str, $raw_output = false)
    {
        static $hashAlgorithm = null;

        if (is_null($hashAlgorithm)) {
            $hashAlgorithm = @Config::getInstance()->General['hash_algorithm'];
        }

        if ($hashAlgorithm) {
            $hash = @hash($hashAlgorithm, $str, $raw_output);
            if ($hash !== false) {
                return $hash;
            }
        }

        return md5($str, $raw_output);
    }
768876
private static String md5(byte[] buffer) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(buffer);
            byte[] digest = md.digest();
            return new String(FlexBase64.encodeBytes(digest, 0, digest.length, false), StandardCharsets.US_ASCII);
        } catch (NoSuchAlgorithmException e) {
            // Should never happen
            throw new InternalError("MD5 not supported on this platform");
        }
    }
356320
def md5(self):
        
        hasher = hashlib.md5()
        for key in sorted(self.data.keys()):
            hasher.update(self.data[key].md5().encode('utf-8'))
        md5 = hasher.hexdigest()
        return md5
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()
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();
    }
662074
def string(s, salt=None):
        
        m = hashlib.md5()
        s = s.encode('utf-8') + salt.encode('utf-8') if salt is not None else s.encode('utf-8')
        m.update(s)
        result = m.hexdigest()
        return result
335463
def md5_digest(instr):
    '''
    
    '''
    return salt.utils.stringutils.to_unicode(
        hashlib.md5(salt.utils.stringutils.to_bytes(instr)).hexdigest()
    )
1094683
function _md5( message ) {
    const hash = crypto.createHash( 'md5' );
    hash.update( message );
    return hash.digest( 'hex' );
}
434787
public static String md5(String data, String salt) {
        return bytes2HexString(md5ToByte((data + salt).getBytes()));
    }
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;
    }
1072343
def md5(text):
    """"""

    h = hashlib.md5()
    h.update(_unicode(text).encode("utf-8"))

    return h.hexdigest()
1263077
public static byte[] sha256Bytes(String str) {
        if (str == null) return null;
        MessageDigest digester;
        try {
            digester = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException ex) {
            throw new RuntimeException(ex);
        }
        return digester.digest(str.getBytes());
    }