using Force.Crc32;
using System.IO;
namespace System.Security.Cryptography
{
partial class Hashs
{
static Crc32Algorithm CreateCrc32()
{
return new Crc32Algorithm();
}
partial class String
{
partial class Lengths
{
public const int Crc32 = 8;
}
///
/// 计算Crc32值
///
///
///
///
public static string Crc32(string text, bool isLower = def_hash_str_is_lower) => ComputeHashString(text, CreateCrc32(), isLower);
///
/// 计算Crc32值
///
///
///
///
public static string Crc32(byte[] buffer, bool isLower = def_hash_str_is_lower) => ComputeHashString(buffer, CreateCrc32(), isLower);
///
/// 计算Crc32值
///
///
///
///
public static string Crc32(Stream inputStream, bool isLower = def_hash_str_is_lower) => ComputeHashString(inputStream, CreateCrc32(), isLower);
}
partial class ByteArray
{
///
/// 计算Crc32值
///
///
///
public static byte[] Crc32(byte[] buffer) => ComputeHash(buffer, CreateCrc32());
///
/// 计算Crc32值
///
///
///
public static byte[] Crc32(Stream inputStream) => ComputeHash(inputStream, CreateCrc32());
}
}
}