1 Star 0 Fork 19

hyfree/Vive.Crypto

forked from Stoneson/Vive.Crypto 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CryptoFactory.cs 2.59 KB
一键复制 编辑 原始数据 按行查看 历史
Stoneson 提交于 2020-05-21 17:04 . addd
using System;
using System.Collections.Generic;
using System.Text;
namespace Vive.Crypto
{
/// <summary>
/// 所有加密创建工厂
/// </summary>
public sealed class CryptoFactory
{
/// <summary>
/// 创建哈希加密提供程序
/// </summary>
/// <param name="providerTypestr"></param>
/// <returns></returns>
public static IHashingProvider CreateHashing(string providerTypestr = "SHA256")
{
return HashingProviderFactory.Create(providerTypestr);
}
/// <summary>
/// 创建哈希加密提供程序
/// </summary>
/// <param name="providerType"></param>
/// <returns></returns>
public static IHashingProvider CreateHashing(HashingProviderType providerType = HashingProviderType.SHA256)
{
return HashingProviderFactory.Create(providerType);
}
//---------------------------------------------------------------------------------------------------------------------
/// <summary>
/// 创建非对称加密提供程序
/// </summary>
/// <param name="providerTypestr"></param>
/// <returns></returns>
public static IAsymmetricProvider CreateAsymmetric(string providerTypestr = "RSA")
{
return AsymmetricProviderFactory.Create(providerTypestr);
}
/// <summary>
/// 创建非对称加密提供程序
/// </summary>
/// <param name="providerType"></param>
/// <returns></returns>
public static IAsymmetricProvider CreateAsymmetric(AsymmetricProviderType providerType = AsymmetricProviderType.RSA)
{
return AsymmetricProviderFactory.Create(providerType);
}
//---------------------------------------------------------------------------------------------------------------------
/// <summary>
/// 创建对称加密提供程序
/// </summary>
/// <param name="providerTypestr"></param>
/// <returns></returns>
public static ISymmetricProvider CreateSymmetric(string providerTypestr = "SM4")
{
return SymmetricProviderFactory.Create(providerTypestr);
}
/// <summary>
/// 创建对称加密提供程序
/// </summary>
/// <param name="providerType"></param>
/// <returns></returns>
public static ISymmetricProvider CreateSymmetric(SymmetricProviderType providerType = SymmetricProviderType.SM4)
{
return SymmetricProviderFactory.Create(providerType);
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/hyfree/Vive.Crypto.git
git@gitee.com:hyfree/Vive.Crypto.git
hyfree
Vive.Crypto
Vive.Crypto
master

搜索帮助