Czlovek.Security 1.0.10

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Czlovek.Security --version 1.0.10
                    
NuGet\Install-Package Czlovek.Security -Version 1.0.10
                    
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="Czlovek.Security" Version="1.0.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Czlovek.Security" Version="1.0.10" />
                    
Directory.Packages.props
<PackageReference Include="Czlovek.Security" />
                    
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 Czlovek.Security --version 1.0.10
                    
#r "nuget: Czlovek.Security, 1.0.10"
                    
#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 Czlovek.Security@1.0.10
                    
#: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=Czlovek.Security&version=1.0.10
                    
Install as a Cake Addin
#tool nuget:?package=Czlovek.Security&version=1.0.10
                    
Install as a Cake Tool

Security

The Utils class provides a collection of utility methods that can be used for various purposes.

Usage

GenerateSalt

byte[] salt = Utils.GenerateSalt();

Generates a random salt byte array of the specified size.

Parameters:

  • size (optional): The size of the salt array to generate, in bytes. Defaults to 128.

Returns:

  • A byte array containing the randomly generated salt.

GetRandomHandler

uint random = Utils.GetRandomHandler();

Generates a random unsigned integer using the default random number generator.

Returns:

  • A random unsigned integer.

HashPassword

string password = "myPassword";
byte[] salt = Utils.GenerateSalt();
string hashedPassword = Utils.HashPassword(password, salt);

Computes the hash value for the specified password using the specified salt and iteration count.

Parameters:

  • password: The password to hash.
  • salt: The salt to use for the hashing operation.
  • iterationCount (optional): The number of iterations to perform. Defaults to 10000.
  • numBytesRequested (optional): The size of the output hash, in bytes. Defaults to 256.

Returns:

  • A string representation of the computed hash value.

RsaCryptoServiceProviderFromPemAsync

string filePath = "myPrivateKey.pem";
RSACryptoServiceProvider rsa = await Utils.RsaCryptoServiceProviderFromPemAsync(filePath);

Reads an RSA key pair from a PEM file asynchronously.

Parameters:

  • filePath: The path of the PEM file to read.

Returns:

  • A task that represents the asynchronous operation. The task result contains the RSA key pair.

Sha256Hash

string value = "myValue";
string sha256Hash = await Utils.Sha256Hash(value);

Computes the SHA256 hash value for the specified string asynchronously.

Parameters:

  • value: The string to hash.

Returns:

  • A task that represents the asynchronous operation. The task result contains the computed hash value.

Md5HashAsync

string value = "myValue";
string md5Hash = await Utils.Md5HashAsync(value);

Computes the MD5 hash value for the specified string asynchronously.

Parameters:

  • value: The string to hash.

Returns:

  • A task that represents the asynchronous operation. The task result contains the computed hash value.

Sha256HashFileAsync

string filename = "myFile.txt";
string sha256Hash = await Utils.Sha256HashFileAsync(filename);

Computes the SHA256 hash value for the specified file asynchronously.

Parameters:

  • filename: The path of the file to hash.
  • createChecksumFile (optional): True to create a checksum file, false otherwise. Defaults to true.

Returns:

  • A task that represents the asynchronous operation. The task result contains the computed hash value.
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.

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
2.1.0-beta.84 47 5/7/2026
2.1.0-beta.83 43 5/7/2026
2.1.0-beta.82 99 3/20/2026
2.1.0-beta.81 65 2/21/2026
2.1.0-beta.80 67 2/21/2026
2.1.0-beta.79 74 2/13/2026
2.1.0-beta.78 81 2/11/2026
2.1.0-beta.77 67 2/11/2026
2.1.0-beta.76 66 2/10/2026
2.1.0-beta.75 74 2/10/2026
2.1.0-beta.74 74 1/28/2026
2.1.0-beta.73 196 11/6/2025
2.1.0-beta.72 189 11/6/2025
2.1.0-beta.71 191 11/4/2025
2.1.0-beta.70 181 11/4/2025
2.1.0-beta.69 182 11/4/2025
2.1.0-beta.68 179 11/4/2025
2.1.0-beta.67 184 11/2/2025
2.1.0-beta.66 175 11/2/2025
1.0.10 576 4/11/2023
Loading failed