300分求帮忙,请问C#怎么做 pack "H*"的效果, 请帮忙实现以下功能
不会perl,我要做一个加密的程序。
或者大家给我一个C#的 请帮忙实现以下功能的
$challenge='27c81c82d52252c2fd0567e859df3c31';
$portal_secret=‘ABCD’;
$ascii_key = pack "H*", $portal_secret;
$login_params='res=success'+'&challenge=$challenge'
my $digest = `echo -n "$login_params" | openssl dgst -sha1 -hmac "$ascii_key"`;
$digest =~ s/[\n\r\s]+$//;
$digest= substr($digest,-40,40);
我用的是,可惜结果不样,请高手帮忙
public static string HashUTF8(string keyStr,string sourceStr)
{
byte[] key = System.Text.Encoding.UTF8.GetBytes(keyStr);
HMACSHA1 hmac = new HMACSHA1(key);
// Convert the input string to a byte array and compute the hash.
byte[] data = hmac.ComputeHash(Encoding.UTF8.GetBytes(sourceStr));
// Create a new Stringbuilder to collect the bytes
// and create a string.
StringBuilder sBuilder = new StringBuilder();
// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
// Return the hexadecimal string.
return sBuilder.ToString();
}
或者大家给我一个C#的 请帮忙实现以下功能的
$challenge='27c81c82d52252c2fd0567e859df3c31';
$portal_secret=‘ABCD’;
$ascii_key = pack "H*", $portal_secret;
$login_params='res=success'+'&challenge=$challenge'
my $digest = `echo -n "$login_params" | openssl dgst -sha1 -hmac "$ascii_key"`;
$digest =~ s/[\n\r\s]+$//;
$digest= substr($digest,-40,40);
我用的是,可惜结果不样,请高手帮忙
public static string HashUTF8(string keyStr,string sourceStr)
{
byte[] key = System.Text.Encoding.UTF8.GetBytes(keyStr);
HMACSHA1 hmac = new HMACSHA1(key);
// Convert the input string to a byte array and compute the hash.
byte[] data = hmac.ComputeHash(Encoding.UTF8.GetBytes(sourceStr));
// Create a new Stringbuilder to collect the bytes
// and create a string.
StringBuilder sBuilder = new StringBuilder();
// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
// Return the hexadecimal string.
return sBuilder.ToString();
}
...全文
相关推荐
多光盘多数据刻录系统的C#实现
在这种情况下,C#作为一种功能强大的编程语言,加之多线程编程技术的应用,能够有效地实现一个多光盘刻录系统。
ComfyUI多模型协同生成室内效果图工作流
室内效果图生成本质上是空间结构理解、语义分割、风格迁移与细节增强的多阶段任务。传统单模型端到端方法难以兼顾几何精度与美学表达,而基于ControlNet结构约束、SAM2空间分割、SDXL+LoRA风格控制及Real-ESRGAN/GFPGAN双引擎超分的模块化方案,实现了结构锁定与风格解耦。该技术路径依托ComfyUI节点式编排,支持显存敏感型部署(如RTX 4090)、可调试中间产物、局部重绘与多LoRA时序调度,广泛适用于装修设计、AI辅助出图、CAD图纸智能化转化等工程场景。
Python图像界面gui编程tkinter实例代码大全.pdf
Python 图像界面 GUI 编程 Tkinter 实例代码大全Python 语言的火爆程度越来越高,已经超过了 Java、C、C# 等其他编程语言。
显示小图像
在实际应用中,这些技术通常与布局管理、事件处理、动画效果等其他功能结合使用,共同构建出丰富多样的用户界面。
ComponentOne Studio for WinForms 2012 v3 2/5
ComponentOne Studio for WinForms 2012 v3 1/5一共有 5 个压缩文件,请全部下载后解压ComponentOne Studio WinForms 2012 v3


