[C#] 纯文本查看 复制代码 private byte[] OperationBytes(byte[] _bytes) {
byte[] array = new byte[4];
byte[] array2 = new byte[_bytes.Length - 4];
Buffer.BlockCopy(_bytes, 0, array, 0, array.Length);
Buffer.BlockCopy(_bytes, 4, array2, 0, array2.Length);
string newStr = Message.ByteToHex(array);
string string_ = Message.ByteToHex(array2);
long num = this.btnHexStrToInt_Click(newStr);
BigInteger dividend = this.XOR(string_);
if (num == 0L)
{
return null;
}
BigInteger num2 = dividend / num;
return Message.strToToHexByte(this.btnIntValueToHex_Click(num2));
}
求助C#转易语言!
不太懂C# 只能看懂点大概意思。第一次发帖,如有不妥,请管理代删帖,谢谢!
其他函数代码如下:
[C#] 纯文本查看 复制代码 public BigInteger XOR(string string_1)
{
return BigInteger.Parse(string_1, NumberStyles.AllowHexSpecifier);
}
private long btnHexStrToInt_Click(string newStr)
{
return Convert.ToInt64(newStr, 16);
}
private string btnIntValueToHex_Click(BigInteger _num)
{
return _num.ToString("X2");
}
public static string ByteToHex(byte[] Bytes)
{
string text = string.Empty;
foreach (byte b in Bytes)
{
text += string.Format("{0:X2}", b);
}
return text.Trim();
}
public static byte[] strToToHexByte(string hexString)
{
byte[] result;
try
{
hexString = hexString.Replace(" ", "");
if (hexString.Length % 2 != 0)
{
hexString += " ";
}
byte[] array = new byte[hexString.Length / 2];
for (int i = 0; i < array.Length; i++)
{
array[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
}
result = array;
}
catch
{
result = null;
}
return result;
}
还缺什么留言,我再发。
第一次发帖,有不妥的地方,请多谅解! |