rootme中Shift cipher破解

看题目说是移位密码,所以懒得看资料,直接写了个程序先跑跑看,发现果然跑出来了。

        private void button1_Click(object sender, EventArgs e)
        {
            string file = @"C:UserswoldyDesktopch7.bin";
            FileInfo fi = new FileInfo(file);
            long len = fi.Length;
            FileStream fs = new FileStream(file, FileMode.Open);
            byte[] buffer = new byte[len];
            fs.Read(buffer, 0, (int)len);
            fs.Close();

            //for (int i = -100; i < 100; i++)
            {
                string pass = "";
                for (int j = 0; j < buffer.Length; j++)
                {
                    pass += (char)(buffer[j] -10);
                    //pass += (char)(buffer[j] +i);
                }
                //textBox1.Text += i+pass + "rn";
                textBox1.Text += pass + "rn";
            }
        }

发表评论