initial commit
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run

This commit is contained in:
i2p
2026-08-27 10:57:58 -06:00
commit 773d05f8f1
1038 changed files with 109261 additions and 0 deletions
@@ -0,0 +1,49 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pulsar.Common.Cryptography;
using Pulsar.Common.Helpers;
using System.Text;
namespace Pulsar.Common.Tests.Cryptography
{
[TestClass]
public class Aes128Tests
{
[TestMethod, TestCategory("Cryptography")]
public void EncryptAndDecryptStringTest()
{
var input = StringHelper.GetRandomString(100);
var password = StringHelper.GetRandomString(50);
var aes = new Aes256(password);
var encrypted = aes.Encrypt(input);
Assert.IsNotNull(encrypted);
Assert.AreNotEqual(encrypted, input);
var decrypted = aes.Decrypt(encrypted);
Assert.AreEqual(input, decrypted);
}
[TestMethod, TestCategory("Cryptography")]
public void EncryptAndDecryptByteArrayTest()
{
var input = StringHelper.GetRandomString(100);
var inputByte = Encoding.UTF8.GetBytes(input);
var password = StringHelper.GetRandomString(50);
var aes = new Aes256(password);
var encryptedByte = aes.Encrypt(inputByte);
Assert.IsNotNull(encryptedByte);
CollectionAssert.AllItemsAreNotNull(encryptedByte);
CollectionAssert.AreNotEqual(encryptedByte, inputByte);
var decryptedByte = aes.Decrypt(encryptedByte);
CollectionAssert.AreEqual(inputByte, decryptedByte);
}
}
}
@@ -0,0 +1,20 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pulsar.Common.Cryptography;
using Pulsar.Common.Helpers;
namespace Pulsar.Common.Tests.Cryptography
{
[TestClass]
public class Sha256Tests
{
[TestMethod, TestCategory("Cryptography")]
public void ComputeHashTest()
{
var input = StringHelper.GetRandomString(100);
var result = Sha256.ComputeHash(input);
Assert.IsNotNull(result);
Assert.AreNotEqual(result, input);
}
}
}