Skip to content

Commit cbfe6d5

Browse files
committed
minor changes to remove some code smells
1 parent e2d701e commit cbfe6d5

8 files changed

Lines changed: 20 additions & 20 deletions

csharp_cryptoexamples/src/ExampleAsymmetricStringEncryption.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace com.cryptoexamples.csharp
66
{
7-
public class ExampleAsymetricStringEncryption
7+
public static class ExampleAsymetricStringEncryption
88
{
9-
public static void Main(string[] args)
9+
public static void Main()
1010
{
1111
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
1212
DemonstrateAsymetricStringEncryption("Text that is going to be sent over an insecure channel and must be encrypted at all costs!");

csharp_cryptoexamples/src/ExampleExampleStringEncryptionPasswordBased.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace com.cryptoexamples.csharp
77
{
8-
public class ExampleStringEncryptionPasswordBased
8+
public static class ExampleStringEncryptionPasswordBased
99
{
10-
public static void Main(string[] args)
10+
public static void Main()
1111
{
1212
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
1313
DemonstrateStringEncryptionPasswordBased("Text that is going to be sent over an insecure channel and must be encrypted at all costs!", "SuperSafe");

csharp_cryptoexamples/src/ExampleFileEncryption.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace com.cryptoexamples.csharp
77
{
8-
public class ExampleFileEncryption
8+
public static class ExampleFileEncryption
99
{
10-
public static void Main(string[] args)
10+
public static void Main()
1111
{
1212
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
1313
Log.Information(DemonstrateFileEncryption("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.", "ThePasswordToDecryptAndEncryptTheFile"));
@@ -72,9 +72,9 @@ public static String DemonstrateFileEncryption(String plainText, string password
7272
{
7373
fsCrypt.Read(salt, 0, salt.Length);
7474

75-
using (CryptoStream cs = new CryptoStream(fsCrypt, AES.CreateDecryptor(), CryptoStreamMode.Read))
75+
using (CryptoStream cs2 = new CryptoStream(fsCrypt, AES.CreateDecryptor(), CryptoStreamMode.Read))
7676
{
77-
using (StreamReader fsOut = new StreamReader(cs))
77+
using (StreamReader fsOut = new StreamReader(cs2))
7878
{
7979
try
8080
{

csharp_cryptoexamples/src/ExampleHashInOneMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace com.cryptoexamples.csharp
66
{
7-
public class ExampleHashing
7+
public static class ExampleHashing
88
{
9-
public static void Main(string[] args)
9+
public static void Main()
1010
{
1111
DemonstrateHashing("Text that should be authenticated by comparing the hash of it!");
1212
}

csharp_cryptoexamples/src/ExampleSignature.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace com.cryptoexamples.csharp
77
{
8-
public class ExampleSigning
8+
public static class ExampleSigning
99
{
10-
public static void Main(string[] args)
10+
public static void Main()
1111
{
1212
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
1313
DemonstrateSigning("Text that should be signed to prevent unknown tampering with its content.");

csharp_cryptoexamples/src/ExampleStringEncryptionKeyBased.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace com.cryptoexamples.csharp
77
{
8-
public class ExampleStringEncryptionKeyBasedInOneMethod
8+
public static class ExampleStringEncryptionKeyBasedInOneMethod
99
{
10-
public static void Main(string[] args)
10+
public static void Main()
1111
{
1212
Log.Logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();
1313
DemonstrateStringEncryptionKeyBased("Text that is going to be sent over an insecure channel and must be encrypted at all costs!");

csharp_cryptoexamples/src/ExmapleKeyStorageProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace csharp_cryptoexamples.src
55
{
6-
public class ExmapleKeyStorageProvider
6+
public static class ExmapleKeyStorageProvider
77
{
88
public static void Main()
99
{

csharp_cryptoexamplesTest/csharp_cryptoexamplesTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private void Refresh()
2323
public void AsymmetricStringEncryptionTest()
2424
{
2525
Refresh();
26-
ExampleAsymetricStringEncryption.Main(null);
26+
ExampleAsymetricStringEncryption.Main();
2727
Assert.Contains("Decrypted and original plain text are the same: True", outMessage.ToString());
2828
}
2929

@@ -32,15 +32,15 @@ public void StringEncryptionPasswordBasedTest()
3232
{
3333
Refresh();
3434
// Basic test if encryption and decryption is working.
35-
ExampleStringEncryptionPasswordBased.Main(null);
35+
ExampleStringEncryptionPasswordBased.Main();
3636
Assert.Contains("They are the same: True", outMessage.ToString());
3737
}
3838

3939
[Fact]
4040
public void FileEncryptionTest()
4141
{
4242
Refresh();
43-
ExampleFileEncryption.Main(null);
43+
ExampleFileEncryption.Main();
4444
Assert.Contains(plainText, outMessage.ToString());
4545
}
4646

@@ -54,7 +54,7 @@ public void HashingTest()
5454
public void SigningTest()
5555
{
5656
Refresh();
57-
ExampleSigning.Main(null);
57+
ExampleSigning.Main();
5858
Assert.Contains("The data was verified.", outMessage.ToString());
5959
}
6060

@@ -63,7 +63,7 @@ public void StringEncryptionKeyBasedTest()
6363
{
6464
Refresh();
6565
// Basic test if encryption and decryption is working.
66-
ExampleStringEncryptionKeyBasedInOneMethod.Main(null);
66+
ExampleStringEncryptionKeyBasedInOneMethod.Main();
6767
Assert.Contains("They are the same: True", outMessage.ToString());
6868
}
6969

0 commit comments

Comments
 (0)