using NCC.Dependency; namespace NCC.DataEncryption.Extensions { /// /// DataEncryption 字符串加密拓展 /// [SuppressSniffer] public static class StringEncryptionExtensions { /// /// 字符串的 MD5 /// /// /// 是否输出大写加密,默认 false /// string public static string ToMD5Encrypt(this string text, bool uppercase = false) { return MD5Encryption.Encrypt(text, uppercase); } /// /// 字符串的 MD5 /// /// /// /// 是否输出大写加密,默认 false /// string public static bool ToMD5Compare(this string text, string hash, bool uppercase = false) { return MD5Encryption.Compare(text, hash, uppercase); } /// /// 字符串 AES 加密 /// /// 需要加密的字符串 /// /// string public static string ToAESEncrypt(this string text, string skey) { return AESEncryption.Encrypt(text, skey); } /// /// 字符串 AES 解密 /// /// /// /// string public static string ToAESDecrypt(this string text, string skey) { return AESEncryption.Decrypt(text, skey); } /// /// 字符串 DESC 加密 /// /// 需要加密的字符串 /// 密钥 /// 是否输出大写加密,默认 false /// string public static string ToDESCEncrypt(this string text, string skey, bool uppercase = false) { return DESCEncryption.Encrypt(text, skey, uppercase); } /// /// 字符串 DESC 解密 /// /// /// 密钥 /// 是否输出大写加密,默认 false /// string public static string ToDESCDecrypt(this string text, string skey, bool uppercase = false) { return DESCEncryption.Decrypt(text, skey, uppercase); } /// /// 字符串 RSA 加密 /// /// 需要加密的文本 /// 公钥 /// public static string ToRSAEncrpyt(this string text, string publicKey) { return RSAEncryption.Encrypt(text, publicKey); } /// /// 字符串 RSA 解密 /// /// 需要解密的文本 /// 私钥 /// public static string ToRSADecrypt(this string text, string privateKey) { return RSAEncryption.Decrypt(text, privateKey); } } }