会PHP的大婶帮忙把这个函数翻译成C#的~~
Jun 06, 2016 pm 07:40 PMusing System; using System.Text; using System.Security.Cryptography; public class Program { private const string key = " key " ; private const string message = " message " ; private static readonly Encoding encoding = Encoding.UTF8; static
using System;
using System.Text;
using System.Security.Cryptography;
public class Program {
private const string key = "key";
private const string message = "message";
private static readonly Encoding encoding = Encoding.UTF8;
static void Main(string[] args) {
var keyByte = encoding.GetBytes(key);
using (var hmacsha256 = new HMACSHA256(keyByte)) { hmacsha256.ComputeHash(encoding.GetBytes(message));
Console.WriteLine("Result: {0}", ByteToString(hmacsha256.Hash));
}
}
static string ByteToString(byte[] buff) {
string sbinary = "";
for (int i = 0; i )
sbinary += buff[i].ToString("X2");
/* hex format */ return sbinary; }
}

熱門文章

熱門文章

熱門文章標籤

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

適用於 Ubuntu 和 Debian 的 PHP 8.4 安裝和升級指南

如何設定 Visual Studio Code (VS Code) 進行 PHP 開發
