VOOZH about

URL: https://www.nuget.org/packages/Mythosia.Security.Cryptography/

⇱ NuGet Gallery | Mythosia.Security.Cryptography 1.1.0




Mythosia.Security.Cryptography 1.1.0

dotnet add package Mythosia.Security.Cryptography --version 1.1.0
 
 
NuGet\Install-Package Mythosia.Security.Cryptography -Version 1.1.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="Mythosia.Security.Cryptography" Version="1.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mythosia.Security.Cryptography" Version="1.1.0" />
 
Directory.Packages.props
<PackageReference Include="Mythosia.Security.Cryptography" />
 
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 Mythosia.Security.Cryptography --version 1.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Mythosia.Security.Cryptography, 1.1.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.
#:package Mythosia.Security.Cryptography@1.1.0
 
 
#: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=Mythosia.Security.Cryptography&version=1.1.0
 
Install as a Cake Addin
#tool nuget:?package=Mythosia.Security.Cryptography&version=1.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Seed

Please see https://seed.kisa.or.kr/kisa/algorithm/EgovSeedInfo.do

The above site includes an English manual.

The IV value is {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}.

  1. Example
var key = KeyGenerator.GenerateSEEDKey();

var dataEncrypted = "test".ToUTF8Array().EncryptSEED(key);	// encrypt with SEED the "test"
var dataDecrypted = dataEncrypted.DecryptSEED(key);		// decrypt with SEED

var stringDecrypted = dataDecrypted.ToUTF8String();		// if you want to convert to string, here the stringDecrypted will be "test"

AES

  1. Example
using Mythosia;
using Mythosia.Security.Cryptography;

var key = KeyGenerator.GenerateAES128Key();
var iv = KeyGenerator.GenerateAES128IV();

var dataEncrypted = "test123456".ToUTF8Array().EncryptAES(key, iv);		// encrypt with AES128 the "test123456" string (if you pass AES256 key then run as AES256)
var dataDecrypted = dataEncrypted.DecryptAES(key, iv);		// decrypt with AES128

var stringDecrypted = dataDecrypted.ToUTF8String();		// if you want to convert to string, here the stringDecrypted will be "test123456"

3DES

  1. Example
using Mythosia;
using Mythosia.Security.Cryptography;

var key = KeyGenerator.Generate3DESKey();
var iv = KeyGenerator.Generate3DESIV();

var dataEncrypted = "test123456".ToUTF8Array().Encrypt3DES(key, iv);		// encrypt with 3DES the "test123456" string
var dataDecrypted = dataEncrypted.Decrypt3DES(key, iv);		// decrypt with 3DES

var stringDecrypted = dataDecrypted.ToUTF8String();		// if you want to convert to string, here the stringDecrypted will be "test123456"

DES

  1. Example
using Mythosia;
using Mythosia.Security.Cryptography;

var key = KeyGenerator.GenerateDESKey();
var iv = KeyGenerator.GenerateDESIV();

var dataEncrypted = "test123456".ToUTF8Array().EncryptDES(key, iv);		// encrypt with DES the "test123456" string
var dataDecrypted = dataEncrypted.DecryptDES(key, iv);		// decrypt with DES

var stringDecrypted = dataDecrypted.ToUTF8String();		// if you want to convert to string, here the stringDecrypted will be "test123456"

SHA, MD2, MD4, MD5

Please see https://emn178.github.io/online-tools/sha1.html

using Mythosia;
using Mythosia.Integrity;

// Example for SHA1
var sha = data.IVHashCode();
var dataWithSha = data.WithIVHashCode();

// Example for SHA256
var sha256 = data.IVHashCode(IVHashType.SHA256);
var dataWithSha256 = data.WithIVHashCode(IVHashType.SHA256);

// Example for SHA384
var sha384 = data.IVHashCode(IVHashType.SHA384);
var dataWithSha384 = data.WithIVHashCode(IVHashType.SHA384);

// Example for SHA512
var sha512 = data.IVHashCode(IVHashType.SHA512);
var dataWithSha512 = data.WithIVHashCode(IVHashType.SHA512);

// Example for MD2
var md2 = data.IVHashCode(IVHashType.MD2);
var dataWithMD2 = data.WithIVHashCode(IVHashType.MD2);

// Example for MD4
var md4 = data.IVHashCode(IVHashType.MD4);
var dataWithMD4 = data.WithIVHashCode(IVHashType.MD4);

// Example for MD5
var md5 = data.IVHashCode(IVHashType.MD5);
var dataWithMD5 = data.WithIVHashCode(IVHashType.MD5);

Application

  1. Using SymmetricAlgorithm with polymorphism
using Mythosia;
using Mythosia.Security.Cryptography;

string contentToEncrypt = "test123456";

// select the one from below
// SEED algorithm is not supported yet but will be supported soon
SymmetricAlgorithm symmetricAlgorithm = Aes.Create();
SymmetricAlgorithm symmetricAlgorithm = TripleDES.Create();
SymmetricAlgorithm symmetricAlgorithm = DES.Create();

// en-decryption with selected algorithm
var encrypted = symmetricAlgorithm.Encrypt(contentToEncrypt.ToUTF8Array(), key, iv);
var decrypted = symmetricAlgorithm.Decrypt(encrypted, key, iv).ToUTF8String();
  1. Using HashAlgorithm with polymorphism
using Mythosia;
using Mythosia.Integrity;

string contentToEncrypt = "test123456";

// select the one from below
// MD4 also support to use as below.
HashAlgorithm hashAlgorithm = SHA1.Create();
HashAlgorithm hashAlgorithm = new MD2();		// only use new MD2(); don't use MD2.Create();
HashAlgorithm hashAlgorithm = new MD4();		// only use new MD4(); don't use MD4.Create();
HashAlgorithm hashAlgorithm = MD5.Create();

// compute hash value using a selected hash algorithm for contentToEncrypt.
hashAlgorithm.ComputeHash(contentToEncrypt.ToUTF8Array());
  1. Using with CRC
// if you have a Mythosia.Integrity library, you can do as below.

using Mythosia;
using Mythosia.Integrity;
using Mythosia.Security.Cryptography;

var contentToEncrypt = "test123456".ToUTF8Array();
var key = KeyGenerator.GenerateAES128Key();
var iv = KeyGenerator.GenerateAES128IV();

var dataEncrypted = contentToEncrypt.WithCheckSum8().EncryptAES(key, iv);		// encrypt with AES128 the "test123456" + checksum8
var dataEncrypted = contentToEncrypt.WithCRC8().EncryptAES(key, iv);		// encrypt with AES128 the "test123456" + crc8
var dataEncrypted = contentToEncrypt.WithCRC16().EncryptAES(key, iv);		// encrypt with AES128 the "test123456" + crc16
var dataEncrypted = contentToEncrypt.WithCRC32().EncryptAES(key, iv);		// encrypt with AES128 the "test123456" + crc32
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 netstandard2.1 is compatible. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.1.0 473 6/25/2023
1.0.1 279 6/22/2023
1.0.0 269 6/20/2023