/// <summary> /// 采用MD5加密字节数组 /// </summary> /// <param name="inputData"></param> /// <returns></returns> public static string EncryptByMD5(byte[] inputData) { using (MD5 m = new MD5CryptoServiceProvider()) { byte[] outputs = m.ComputeHash(inputData); return(EncodingUtility.ToBase64FromBytes(outputs)); } }
/// <summary> /// 采用MD5计算二进制序列的Hash结果,并转换成Base64格式的字符串返回 /// </summary> /// <param name="inputs"></param> /// <returns></returns> public static string ComputeHashStringByMD5(byte[] inputs) { return(EncodingUtility.ToBase64FromBytes(EncryptUtility.ComputeHashByMD5(inputs))); }
/// <summary> /// 采用MD5计算二进制序列的Hash结果,并转换成Base64格式的字符串返回 /// </summary> /// <param name="inputs"></param> /// <returns></returns> public static string ComputeHashStringByMD5(string fileName) { return(EncodingUtility.ToBase64FromBytes(ComputeHashByMD5(fileName))); }