Skip to content

Commit

Permalink
by EbraSha
Browse files Browse the repository at this point in the history
ver 2.1
  • Loading branch information
ebrasha committed Aug 25, 2024
1 parent 2ab1eb0 commit e51fa13
Show file tree
Hide file tree
Showing 7 changed files with 1,648 additions and 265 deletions.
6 changes: 3 additions & 3 deletions Abdal Security Group App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>2.0</Version>
<AssemblyVersion>2.0</AssemblyVersion>
<FileVersion>2.0</FileVersion>
<Version>2.1</Version>
<AssemblyVersion>2.1</AssemblyVersion>
<FileVersion>2.1</FileVersion>
<AssemblyName>Abdal Blowfish Encryption</AssemblyName>
<ApplicationIcon>Dev\UI\logo.ico</ApplicationIcon>
<PackageIcon>128.png</PackageIcon>
Expand Down
1 change: 1 addition & 0 deletions Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 41 additions & 46 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,60 +327,55 @@ private void pictureBox1_Click(object sender, EventArgs e)

private void bg_worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
crypt.CryptAlgorithm = EncryptionAlgorithmList.Text;
crypt.CipherMode = CipherModeList.Text;
crypt.KeyLength = int.Parse(KeyLengthList.Text);
crypt.PaddingScheme = 0;
crypt.EncodingMode = EncodingModeList.Text;
string ivHex = "";

if (EncryptionAlgorithmList.Text == "blowfish2")
{
ivHex = "0001020304050607";
}
else
{
ivHex = "000102030405060708090A0B0C0D0E0F";
}

crypt.SetEncodedIV(ivHex, "hex");
string keyHex = SecretKeyTextBox.Text;
crypt.SetEncodedKey(keyHex, "hex");

if (SwitchOperation.Value)
{
// Mean user try to encrypt something

Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
crypt.CryptAlgorithm = EncryptionAlgorithmList.Text;
crypt.CipherMode = CipherModeList.Text;
crypt.KeyLength = int.Parse(KeyLengthList.Text);
crypt.PaddingScheme = 0;
crypt.EncodingMode = EncodingModeList.Text;
string ivHex = "";
if (EncryptionAlgorithmList.Text == "blowfish2")
{
// blowfish2
ivHex = "0001020304050607";
}
else
{
//twofish
ivHex = "000102030405060708090A0B0C0D0E0F";
}
// User is trying to encrypt something
string rawText = RawtextForm.GetRawText();

// Convert the string to a byte array using UTF-8 encoding
byte[] inputBytes = System.Text.Encoding.UTF8.GetBytes(rawText);

crypt.SetEncodedIV(ivHex, "hex");
// Secret Key
string keyHex = SecretKeyTextBox.Text;
crypt.SetEncodedKey(keyHex, "hex");
string encStr = crypt.EncryptStringENC(RawtextForm.GetRawText());
// Encrypt the byte array
byte[] encryptedBytes = crypt.EncryptBytes(inputBytes);

// Convert the encrypted bytes to a hex string for display/storage
string encStr = crypt.Encode(encryptedBytes, "hex");
SendEncTextToForm(encStr);
}
else
{
Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
crypt.CryptAlgorithm = EncryptionAlgorithmList.Text;
crypt.CipherMode = CipherModeList.Text;
crypt.KeyLength = int.Parse(KeyLengthList.Text);
crypt.PaddingScheme = 0;
crypt.EncodingMode = EncodingModeList.Text;
string ivHex = "";
if (EncryptionAlgorithmList.Text == "blowfish2")
{
// blowfish2
ivHex = "0001020304050607";
}
else
{
//twofish
ivHex = "000102030405060708090A0B0C0D0E0F";
}
// User is trying to decrypt something
string encStr = EncTextForm.GetEncText();

// Convert the hex string back to byte array
byte[] encryptedBytes = crypt.Decode(encStr, "hex");

// Decrypt the byte array
byte[] decryptedBytes = crypt.DecryptBytes(encryptedBytes);

crypt.SetEncodedIV(ivHex, "hex");
// Secret Key
string keyHex = SecretKeyTextBox.Text;
crypt.SetEncodedKey(keyHex, "hex");
string decStr = crypt.DecryptStringENC(EncTextForm.GetEncText());
// Convert the decrypted byte array back to a string
string decStr = System.Text.Encoding.UTF8.GetString(decryptedBytes);
SetDeCryptTextToForm(decStr);
}
}
Expand Down
33 changes: 32 additions & 1 deletion obj/Abdal Security Group App.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"projects": {
"C:\\Users\\EbraSha\\Documents\\Github\\Abdal Blowfish Encryption\\Abdal Security Group App.csproj": {
"version": "2.0.0",
"version": "2.1.0",
"restore": {
"projectUniqueName": "C:\\Users\\EbraSha\\Documents\\Github\\Abdal Blowfish Encryption\\Abdal Security Group App.csproj",
"projectName": "Abdal Blowfish Encryption",
Expand Down Expand Up @@ -54,6 +54,18 @@
"target": "Package",
"version": "[9.50.99, )"
},
"Microsoft.NET.ILLink.Analyzers": {
"suppressParent": "All",
"target": "Package",
"version": "[7.0.100-1.23401.1, )",
"autoReferenced": true
},
"Microsoft.NET.ILLink.Tasks": {
"suppressParent": "All",
"target": "Package",
"version": "[7.0.100-1.23401.1, )",
"autoReferenced": true
},
"Microsoft.Windows.Compatibility": {
"target": "Package",
"version": "[8.0.8, )"
Expand Down Expand Up @@ -82,6 +94,20 @@
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Runtime.win-x86",
"version": "[7.0.20, 7.0.20]"
},
{
"name": "Microsoft.NETCore.App.Runtime.win-x86",
"version": "[7.0.20, 7.0.20]"
},
{
"name": "Microsoft.WindowsDesktop.App.Runtime.win-x86",
"version": "[7.0.20, 7.0.20]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
Expand All @@ -92,6 +118,11 @@
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.302\\RuntimeIdentifierGraph.json"
}
},
"runtimes": {
"win-x86": {
"#import": []
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion obj/Abdal Security Group App.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\EbraSha\.nuget\packages\;C:\Program Files (x86)\Progress\ToolboxNuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.1</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\EbraSha\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Progress\ToolboxNuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.net.illink.tasks\7.0.100-1.23401.1\build\Microsoft.NET.ILLink.Tasks.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.illink.tasks\7.0.100-1.23401.1\build\Microsoft.NET.ILLink.Tasks.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.net.illink.analyzers\7.0.100-1.23401.1\build\Microsoft.NET.ILLink.Analyzers.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.illink.analyzers\7.0.100-1.23401.1\build\Microsoft.NET.ILLink.Analyzers.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgUI_for_WinForms_AllControls_Net70 Condition=" '$(PkgUI_for_WinForms_AllControls_Net70)' == '' ">C:\Users\EbraSha\.nuget\packages\ui.for.winforms.allcontrols.net70\2023.2.718</PkgUI_for_WinForms_AllControls_Net70>
<PkgMicrosoft_NET_ILLink_Tasks Condition=" '$(PkgMicrosoft_NET_ILLink_Tasks)' == '' ">C:\Users\EbraSha\.nuget\packages\microsoft.net.illink.tasks\7.0.100-1.23401.1</PkgMicrosoft_NET_ILLink_Tasks>
</PropertyGroup>
</Project>
Loading

0 comments on commit e51fa13

Please sign in to comment.