mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-12-29 18:04:42 +08:00
feat(tenpayv3): 新增 SM3 算法工具类
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
|
||||
{
|
||||
public class TestCase_SM3UtilityTests
|
||||
{
|
||||
[Fact(DisplayName = "测试用例:计算 SM3 哈希值")]
|
||||
public void TestSM3Hash()
|
||||
{
|
||||
byte[] msgBytes = Convert.FromBase64String("QXdlc29tZSBTS0lULkZsdXJsSHR0cENsaWVudC5XZWNoYXQuVGVucGF5VjMh");
|
||||
string expectedHashText = "3F5EC5A79871755905E34013FD86D906B334281D2CA5B9FF612A136C7C377815";
|
||||
string actualHashText = BitConverter.ToString(Utilities.SM3Utility.Hash(msgBytes)).Replace("-", "");
|
||||
|
||||
Assert.Equal(actualHashText, expectedHashText, ignoreCase: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user