newdcm.Cryptor 1.0.4

dotnet add package newdcm.Cryptor --version 1.0.4
                    
NuGet\Install-Package newdcm.Cryptor -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="newdcm.Cryptor" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="newdcm.Cryptor" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="newdcm.Cryptor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add newdcm.Cryptor --version 1.0.4
                    
#r "nuget: newdcm.Cryptor, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package newdcm.Cryptor@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=newdcm.Cryptor&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=newdcm.Cryptor&version=1.0.4
                    
Install as a Cake Tool

1. 常用的加解密方法及hash值计算方法

1.1 AESCryptHelper类

AES对称加密与解密的工具类

  string sourceStr = "要加密的串";
  string key = "encryptKey密钥";
  string iv = "iv偏移量";
  string cryptBase64Str = AESCryptHelper.Encrypt(sourceStr,key,iv);
  string sourceStr = AESCryptHelper.Decrypt(cryptBase64Str,key,iv);

1.2 HashHelper类

常用的Hash值计算方法,包括计算字符串,本地文件,流的Md5,SHA1,SHA256等类型的Hash值

 var algorithm = MD5.Create();
 // var algorithm = SHA1.Create();
 // var algorithm = SHA256.Create();
 // 计算字符串md5值
 string md5Str = await HashHelper.Instance().ComputeStringHash("原串",algorithm);
 // 获取文件md5值(此方法进行了效率优化,50M以下的直接获取hash,50M以上的采用流式计算)
 string filePath = "D:\\1.txt";
 string fileMd5 = await HashHelper.Instance().ComputeFileHash(filePath,algorithm);
 // 同时获取文件的md5,sha1与sha256值(高效流式分块计算)
 var fileHashAll = await HashHelper.Instance().ComputeFileAllHash(filePath);
 string md5OfFile = fileHashAll.Item1;
 string sha1OfFile = fileHashAll.Item2;
 string sha256OfFile = fileHashAll.Item3;
 //另外就是针对stream类型的hash计算
 //HashHelper.Instance().ComputeStreamHash(stream,algorithm); //直接计算
 //HashHelper.Instance().ComputeStreamHash2(stream,algorithm); //高效流式分块计算
 //HashHelper.Instance().ComputeAllHash(stream);//高效流式分块计算三种hash返回
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 91 4/12/2026
1.0.3 113 4/11/2026 1.0.3 is deprecated because it has critical bugs.
1.0.1 209 9/28/2025 1.0.1 is deprecated because it is no longer maintained.
1.0.0 215 12/3/2024 1.0.0 is deprecated because it is no longer maintained.