Twileloop.Security 2.0.0

The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Twileloop.Security --version 2.0.0
NuGet\Install-Package Twileloop.Security -Version 2.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="Twileloop.Security" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Twileloop.Security --version 2.0.0
#r "nuget: Twileloop.Security, 2.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 Twileloop.Security as a Cake Addin
#addin nuget:?package=Twileloop.Security&version=2.0.0

// Install Twileloop.Security as a Cake Tool
#tool nuget:?package=Twileloop.Security&version=2.0.0

<br /> <div align="center"> <a href=""> <img src="" alt="Logo" width="80" height="80"> </a>

<h2 align="center"> Twileloop.Security </h2> <h4 align="center"> Encode | Encrypt | Hash </h4>

Note Formly known as Twileloop.ExpressSecurity



An all in one library that centralizes multiple algorithms for encoding, encrypting and hashing in one place to be used anywhere in the code.

Note Starting from version v1.2 and above, This is the official documentation. For older versions, Refer old documentation <a href=""> here </a>


Twileloop.Security is licensed under the MIT License. See the LICENSE file for more details.

This library is absolutely free. If it gives you a smile, A small coffee would be a great way to support my work. Thank you for considering it!

"Buy Me A Coffee"

1. Install Core Package

dotnet add package Twileloop.Security

Supported Algorithms

Encoding Algorithms Encryption Algorithms Hashing Algorithms
✅ UTF-8 ✅ RSA ✅ SHA1
✅ Base64 ✅ SHA256
✅ Hex ✅ SHA3
✅ Binary ✅ Blake2
✅ BCrypt
✅ Argon2

2. Encode/Decode Text

Encode or decode text in multiple supported formats

    //Encoding Algorithms

    //1. ASCII
    var data1 = ASCIIEncoder.Encode("English");
    var data2 = ASCIIEncoder.Decode(data1);
    //2. UTF-8
    var data3 = UTF8Encoder.Encode("മലയാളം");
    var data4 = UTF8Encoder.Decode(data3);
    //3. Base64
    var data5 = Base64Encoder.Encode("मैं तुमसे प्यार करता हूँ");
    var data6 = Base64Encoder.Decode(data5);
    //4. Hex
    var data7 = HexEncoder.Encode("أنا ذاهب");
    var data8 = HexEncoder.Decode(data7);
    //5. Binary
    var data9 = BinaryEncoder.Encode("நான் உன்னை அன்புக்குரியேன்");
    var data10 = BinaryEncoder.Decode(data9);

3. Encrypt/Decrypt Text or File

Encrypt or decrypt text or file in multiple supported formats

    //1. AES (Text)
    var aesEncryptedData = AESAlgorithm.EncryptText("Twileloop", key: "1234", iv: "1234567890123456");
    var aesDecryptedData = AESAlgorithm.DecryptText(aesEncryptedData, key: "1234", iv: "1234567890123456");
    //2. AES (File)
    AESAlgorithm.EncryptFile(@"D:\data.txt", @"D:\data_aes_encrypted.aes", key: "1234", iv: "1234567890123456");
    AESAlgorithm.DecryptFile(@"D:\data_aes_encrypted.aes", @"D:\data_aes_decrypted.txt", key: "1234", iv: "1234567890123456");
    //Make Keys
    RSAAlgorithm.MakeRSAKeyPairs(out RSAParameters publicKey, out RSAParameters privateKey);
    //1. RSA (Text)    
    var rsaEncryptedData = RSAAlgorithm.EncryptText("Twileloop", publicKey);
    var rsaDecryptedData = RSAAlgorithm.DecryptText(rsaEncryptedData, privateKey);
    //2. RSA (File)
    RSAAlgorithm.EncryptFile(@"D:\data.txt", @"D:\data_rsa_encrypted.rsa", publicKey);
    RSAAlgorithm.DecryptFile(@"D:\data_rsa_encrypted.rsa", @"D:\data_rsa_decrypted.txt", privateKey);

4. Hash Text

Hash text in multiple supported formats

    // Hashing Algorithms

    //1 - MD5
    var hash1 = MD5Algorithm.Hash("Sangeeth Nandakumar");
    //2 - SHA1
    var hash2 = SHAAlgorithm.HashUsingSHA1("Sangeeth Nandakumar");
    //3 - SHA256 
    var hash3 = SHAAlgorithm.HashUsingSHA256("Sangeeth Nandakumar");
    //4 - SHA3 
    var hash4 = SHAAlgorithm.HashUsingSHA3("Sangeeth Nandakumar");
    //5 - Blake2 
    var hash5 = Blake2DigestAlgorithm.Hash("Sangeeth Nandakumar");
    //6 - BCrypt 
    var hash7 = BCryptAlgorithm.Hash("Sangeeth Nandakumar", workFactor: 11);
    //7 - Argon2
    var hash8 = Argon2Algorithm.Hash("Sangeeth Nandakumar", byteSize: 32, iterations: 1, memorySizeKB: 4096, degreeOfParallelism: 1);
Product 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.

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.2.0 250 8/12/2023
2.1.0 141 8/12/2023
2.0.0 168 5/13/2023