昨天先尝试利用 HttpClientFactory
来建立呼叫外部API,今天来谈谈要如何实作先前的程序码吧
先直接上程序码,这边选择用service打包,原因是为了希望之後更方便在外部调用:
至於HashID的部分,暂时先把杂凑值写死XD
using System.Numerics;
using System.Security.Policy;
using System.Threading.Tasks;
namespace Qpay_Core.Services
{
public class SignService
{
public static string GetSign(string nonce,string data)
{
string hashId = GetHashID();
string sign = data + nonce + hashId;
return SHA256_Hash.GetSHA256Hash(sign).ToUpper();
}
public static string GetHashID()
{
//杂凑输入四个值.........
string value1 = GetXORencrypt(A1, A2);
string value2 = GetXORencrypt(B1, B2);
return (value1 + value2).ToUpper();
}
public static string GetXORencrypt(string hex1, string hex2)
{
BigInteger dec1 = BigInteger.Parse(hex1, NumberStyles.HexNumber);
BigInteger dec2 = BigInteger.Parse(hex2, NumberStyles.HexNumber);
BigInteger result = dec1 ^ dec2;
string hexResult = result.ToString("X");
return hexResult;
}
}
}
>>: Day 9 - Functional Programming 初探 (2) - Currying 与 Composition
今天会接续昨天的部分继续讲解 Theme 的 Spacing,这部分其实很简单各位可以透过这里直接引...
[鬼故事] - 我的密码是... Credit: 一级玩家 如果有人把密码这样写在座位上,请小心这些...
市面上可以制作游戏的引擎满多的 例Unity, Unreal, RPG Maker,... 等等 这...
前言 这篇还是要继续来介绍jconsole,Thread的页签介绍 Step.1 首先准备一个Jco...
为什麽要写这篇? 专案开发过程中,常会需要设计schema,建立新的table,由於我是自学转职的...