This commit is contained in:
cjd
2025-11-04 21:09:16 +08:00
parent 8260e293c7
commit bb90a020dc
592 changed files with 61749 additions and 27 deletions

View File

@@ -0,0 +1,42 @@
using DouyinApi.Common.Helper;
using DouyinApi.Common.Helper.SM;
using System;
using Xunit;
namespace DouyinApi.Tests.Common_Test
{
public class SM4Helper_Should
{
[Fact]
public void Encrypt_ECB_Test()
{
var plainText = "暗号";
var sm4 = new SM4Helper();
Console.Out.WriteLine("ECB模式");
var cipherText = sm4.Encrypt_ECB(plainText);
Console.Out.WriteLine("密文: " + cipherText);
Assert.NotNull(cipherText);
Assert.Equal("VhVDC0KzyZjAVMpwz0GyQA==", cipherText);
}
[Fact]
public void Decrypt_ECB_Test()
{
var cipherText = "Y9ygWexdpuLQjW/qsnZNQw==";
var sm4 = new SM4Helper();
Console.Out.WriteLine("ECB模式");
var plainText = sm4.Decrypt_ECB(cipherText);
Console.Out.WriteLine("明文: " + plainText);
Assert.NotNull(plainText);
Assert.Equal("老张的哲学", plainText);
}
}
}