C# 如何将此编码器反转为解码器?
正在尝试反转此编码器以解码此加密的pw 我需要它以另一种方式移动位(不知道其他方式如何放置) 我对C#几乎一无所知,所以如果有人能帮忙,那就太好了 如果将“test”放入pw变量中,它将对其进行编码,但如果将编码的过程放入其中(7C9F9ABDB6377037B4B3B33AE91BC),它将失败,因为它已编码。所以我需要反转它,这样它将解码7C9F9ABDB6377037B4B3B3BA31A31AE91BCC# 如何将此编码器反转为解码器?,c#,decode,C#,Decode,正在尝试反转此编码器以解码此加密的pw 我需要它以另一种方式移动位(不知道其他方式如何放置) 我对C#几乎一无所知,所以如果有人能帮忙,那就太好了 如果将“test”放入pw变量中,它将对其进行编码,但如果将编码的过程放入其中(7C9F9ABDB6377037B4B3B33AE91BC),它将失败,因为它已编码。所以我需要反转它,这样它将解码7C9F9ABDB6377037B4B3B3BA31A31AE91BC using System; using System.Collections.Gen
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace eee
{
public class Form1
{
static void Main(string[] args)
{
string pw = "7c9f9abdb6377037b4b3ba31ae91bc";
//string encodedURL = "¶×\x0097ØÝf´\x0093çÛª\x0092Õ\x0094Þ\x0086";
//fb46114d0f3e594759eefee810e60aa7fea300a30201a6a3040db6a70a0d
byte[] bytes = Encoding.ASCII.GetBytes(pw);
List<byte> byteList = new List<byte>();
char[] array = "cUsToMeNcOdElOl".ToArray<char>();
for (int index = 0; index <= bytes.Length - 1; ++index)
{
int num = (int)bytes[index] + ((int)bytes[index] + index) - 42;
if (num <= 0)
num = (int)bytes[index] + ((int)bytes[index] + index) + 43;
if (index > array.Length)
num += (int)array[index];
byteList.Add((byte)num);
}
Console.WriteLine(Form1.ByteArrayToString(byteList.ToArray()));
Console.ReadLine();
}
public static string ByteArrayToString(byte[] ba)
{
StringBuilder stringBuilder = new StringBuilder(ba.Length * 2);
foreach (byte num in ba)
stringBuilder.AppendFormat("{0:x2}", (object)num);
return stringBuilder.ToString();
}
public static byte[] StringToByteArray(string input)
{
return Encoding.ASCII.GetBytes(input);
}
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
名称空间eee
{
公开课表格1
{
静态void Main(字符串[]参数)
{
字符串pw=“7c9f9abdb6377037b4b3ba31ae91bc”;
//字符串encodedURL=“”“×\x0097Ø221; f'\x0093Ûª\x0092Õ\x0094Þ\x0086”;
//fb46114d0f3e594759eefee810e60aa7fea300a30201a6a3040db6a70a0d
byte[]bytes=Encoding.ASCII.GetBytes(pw);
List byteList=新列表();
char[]array=“cUsToMeNcOdElOl.ToArray();
for(int index=0;索引字符串pw=Encoding.ASCII.GetString(字节[]);我不明白你的意思。:/是的,但我正在尝试解码这个编码的字符串。所以我必须颠倒它的作用,不知道如何做,尽管我在C方面没有经验。发布的代码失败了,所以我不知道你到底需要做什么。我知道你在尝试什么。你发布的代码出现了索引外错误。有一些需要解决这个问题。