using System.IO;
namespace System.Security.Cryptography
{
partial class Hashs
{
static SHA512 CreateSHA512()
{
try
{
return SHA512.Create();
}
catch
{
return new SHA512CryptoServiceProvider();
}
}
partial class String
{
partial class Lengths
{
public const int SHA512 = 128;
}
///
/// 计算SHA512值
///
///
///
///
public static string SHA512(string text, bool isLower = def_hash_str_is_lower) => ComputeHashString(text, CreateSHA512(), isLower);
///
/// 计算SHA512值
///
///
///
///
public static string SHA512(byte[] buffer, bool isLower = def_hash_str_is_lower) => ComputeHashString(buffer, CreateSHA512(), isLower);
///
/// 计算SHA512值
///
///
///
///
public static string SHA512(Stream inputStream, bool isLower = def_hash_str_is_lower) => ComputeHashString(inputStream, CreateSHA512(), isLower);
}
partial class ByteArray
{
///
/// 计算SHA512值
///
///
///
public static byte[] SHA512(byte[] buffer) => ComputeHash(buffer, CreateSHA512());
///
/// 计算SHA512值
///
///
///
public static byte[] SHA512(Stream inputStream) => ComputeHash(inputStream, CreateSHA512());
}
}
}