CA.Blocks.Security 1.1.18

dotnet add package CA.Blocks.Security --version 1.1.18
                    
NuGet\Install-Package CA.Blocks.Security -Version 1.1.18
                    
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="CA.Blocks.Security" Version="1.1.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CA.Blocks.Security" Version="1.1.18" />
                    
Directory.Packages.props
<PackageReference Include="CA.Blocks.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 CA.Blocks.Security --version 1.1.18
                    
#r "nuget: CA.Blocks.Security, 1.1.18"
                    
#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 CA.Blocks.Security@1.1.18
                    
#: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=CA.Blocks.Security&version=1.1.18
                    
Install as a Cake Addin
#tool nuget:?package=CA.Blocks.Security&version=1.1.18
                    
Install as a Cake Tool

NuGet version (CA.Blocks.Security) Build Status

The Blocks will produce Random Text, Hashs and implement Encryption / Decryption

HASH Example

    public void SHA256HashExample()    
    {
        var input = "test";
        var base64hasHResult = SHA256Hash.Instance.GenerateHashAsBase64(input);
        Console.WriteLine(base64hasHResult);
        // will produce n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg= 
        var Hexadecimal = SHA256Hash.Instance.GenerateHashAsHexadecimal(input);
        Console.WriteLine(Hexadecimal);
        // will produce 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
    }

Encryption Example

    public void EncryptionExample()
    {
        // Create a new AesCrypto instance seeded with "123" as salt for the initialization vector
        // we use the salt such that the same encrypted value will product a difference cypher text
        // this is allows us to seed each SymmetricEncryption to a different value if needed like 
        // for example each customer can have their own salt value
        ISymmetricEncryption targetEncrypter = new AesCrypto("123");

        Console.WriteLine(targetEncrypter.Encrypt("OriginalText", "secret"));
        // output will be   "1vHyXdWtrigZm5S5Kbksm/A0UyJ7Z4mERnZiFjypQNA="
        Console.WriteLine(targetEncrypter.Decrypt("1cdFBg67qpr6XKgDXJlf4Y7GbUZv5DiMV6ynjQ2PwKU=", "secret"));
        // output will be  OriginalText
        ISymmetricEncryption targetEncrypter2 = new AesCrypto("1234");
        Console.WriteLine(targetEncrypter2.Encrypt("OriginalText", "secret"));
        // output will be   "FpEv1Eh9qj0c7qeHmBOz4xABCbLGz5ljLgvgNVQOLBo="
        Console.WriteLine(targetEncrypter2.Decrypt("FpEv1Eh9qj0c7qeHmBOz4xABCbLGz5ljLgvgNVQOLBo=", "secret"));
        // output will be OriginalText 
    }

Random Text Example

    public void PasswordGeneratorExample()
    {
        var passwordGenerator = new RandomTextGenerator(new RandomTextGeneratorSettings { AllowedChars = RandomTextGeneratorSettings.ASCIIPass });
        string example = passwordGenerator.Generate(12);
        Console.WriteLine(example);
        // exmaple output:  |NAQr%gpyVb2
        // Will Producte Randon password of 12 charchers useing the CharSet
        //  ASCIIPass = " !\"#$%&()*+-/2345679:;<=>?@ACDEFGHJLKLMNPQRSTUVXYZ[\\]^_abcdefghklmnopqrstuvxyz{|}~"
        // This exludes ambigious characters like '1' and 'l' or '0' and 'O' from the generated password
    }
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.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.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.1.18 252 12/15/2025
1.1.17-prerelease 248 12/15/2025
1.1.16-prerelease 198 12/14/2025
1.1.15-prerelease 197 12/14/2025
1.1.14-prerelease 101 12/13/2025
1.1.1 656 9/22/2022
1.0.1 1,811 4/13/2016