Effortless.Net.Encryption
4.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Effortless.Net.Encryption --version 4.0.0
NuGet\Install-Package Effortless.Net.Encryption -Version 4.0.0
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="Effortless.Net.Encryption" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Effortless.Net.Encryption --version 4.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Effortless.Net.Encryption, 4.0.0"
#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.
// Install Effortless.Net.Encryption as a Cake Addin #addin nuget:?package=Effortless.Net.Encryption&version=4.0.0 // Install Effortless.Net.Encryption as a Cake Tool #tool nuget:?package=Effortless.Net.Encryption&version=4.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Effortless .Net Encryption
Project Description
Effortless .Net Encryption is a library that is written in C# and provides:
- Rijndael encryption/decryption.
- Hashing and Digest creation/validation.
- Password and salt creation.
Give a Star! ⭐
If you like or are using this project please give it a star. Thanks!
Nuget
https://nuget.org/packages/Effortless.Net.Encryption/
To install Effortless.Net.Encryption, run the following command in the Package Manager Console
PM> Install-Package Effortless.Net.Encryption
Overview
The project is split into four main areas
- Strings – Encryption/Decryption/Password and Salt generation
- Hash – Creation and verification of hashes using MD5, SHA1, SHA256, SHA384, SHA512.
- Digest – Creation and verification of digests (data + hash). Plus two handy ToString() and CreateFromString() functions which come in handy if you want to store data in a Cookie.
- Bytes – The core of the library. This uses the Rijndael algorithm and works at the byte[] level for most functions.
Some examples
// Creating passwords & salts
string password = Strings.CreatePassword(15, true);
string salt = Strings.CreateSalt(20);
// Encrypting/decrypting strings
byte[] key = Bytes.GenerateKey();
byte[] iv = Bytes.GenerateIV();
string encrypted = Strings.Encrypt("Secret", key, iv);
string decrypted = Strings.Decrypt(encrypted, key, iv);
Assert.AreEqual("Secret", decrypted);
// Hashes
string hash = Hash.Create(HashType.SHA512, "Hello", string.Empty, false);
// Digests
var d1 = Digest.Create(HashType.MD5, "Hello", string.Empty);
string cookieString = d1.ToString();
var d2 = Digest.CreateFromString(cookieString, string.Empty);
Assert.AreEqual(d1.Data, d2.Data);
Assert.AreEqual(d1.Hash, d2.Hash);
// Bytes
byte[] key = Bytes.GenerateKey();
byte[] iv = Bytes.GenerateIV();
var data = new byte[1024];
new RNGCryptoServiceProvider().GetBytes(data); // Random data
byte[] encrypted = Bytes.Encrypt(data, key, iv);
byte[] decrypted = Bytes.Decrypt(encrypted, key, iv);
Assert.AreEqual(data, decrypted);
// Digital Signatures
var hash = Hash.Create(HashType.SHA256, "Hello", string.Empty)
var ds = new DigitalSignature();
ds.AssignNewKey();
var signature = ds.SignData(hash);
var result = ds.VerifySignature(hash, signature);
Assert.IsTrue(result);
// Diffie Hellman
var alice = new DiffieHellman();
var bob = new DiffieHellman();
// Bob uses Alice's public key to encrypt his message.
var secretMessage = bob.Encrypt(alice, "Hello");
// Alice uses Bob's public key and IV to decrypt the secret message.
var decryptedMessage = alice.Decrypt(bob, secretMessage);
Assert.AreEqual("Hello", decryptedMessage);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- System.Security.Cryptography.Cng (>= 5.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Effortless.Net.Encryption:
Package | Downloads |
---|---|
DS.Foundation
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.