Openssl C代码转换为C# [英] Openssl C code convert into C#
本文介绍了Openssl C代码转换为C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,我必须将代码转换成c#
I have a problem that i have to convert c the code into c#
UBYTE * ret;
ret = (UBYTE *)malloc(20);
memset(ret, 0, 20);
sscanf(argv[1], "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
&ret[0], &ret[1], &ret[2], &ret[3], &ret[4],
&ret[5], &ret[6], &ret[7], &ret[8], &ret[9],
&ret[10], &ret[11], &ret[12], &ret[13], &ret[14],
&ret[15], &ret[16], &ret[17], &ret[18], &ret[19]);
我的尝试:
代码是在c现在我想把它转换成C#
我创建了一个数组byte [] ret = new byte [20] ;
现在接着我做什么?
What I have tried:
the code is in c now i want to convert it into C#
I had created a array byte[] ret=new byte[20];
now next what i do??
推荐答案
代码转换包含十六进制字符的字符串一个字节数组,这是一个常见问题:
如何将十六进制字符串转换为字节数组
搜索它可以提供很多结果,例如:
c# - 如何将字节数组转换为十六进制字符串,反之亦然? - 堆栈溢出 [ ^ ]
将十六进制字符串转换为相应的字节数组Heikki Ritvanen [ ^ ]
The code is converting a string containing hex characters to a byte array which is a frequently asked question:
"How to convert a hex string to byte array"
Searching for that provides a lot of results like:
c# - How do you convert Byte Array to Hexadecimal String, and vice versa? - Stack Overflow[^]
Converting Hex String To Corresponding Byte Array Using C# | Heikki Ritvanen[^]
这篇关于Openssl C代码转换为C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文