init
This commit is contained in:
42
DouyinApi.Tests/Common_Test/SM4Helper_Should.cs
Normal file
42
DouyinApi.Tests/Common_Test/SM4Helper_Should.cs
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user