Effortless.Net.Encryption 4.0.0

.NET Standard 2.1
Install-Package Effortless.Net.Encryption -Version 4.0.0
dotnet add package Effortless.Net.Encryption --version 4.0.0
<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, C# scripting and .NET Interactive. 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
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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
4.0.0 937 12/21/2021
3.3.0 84,116 10/18/2019
3.2.0 26,536 7/12/2018
3.1.0 1,357 4/11/2018
3.0.1 718 4/9/2018
2.1.0 772 4/9/2018
2.0.1.37 23,493 1/19/2015
2.0.0.35 1,636 12/22/2014
1.1.0.32 5,206 8/28/2012