C#加密

using System;
using System.Text;
using System.IO;

namespace 这是一个加密文件的程序
{
    public class _输入你的加密口令
    {
        private string password;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public _输入你的加密口令(string temp)
        {
            this.password = temp;
        }
        public _输入你的加密口令()
        {
            Console.WriteLine("请输入你的口令:");
            this.Password=Console.ReadLine();  //没有写完。。不晓得杂写了,下雨了,先睡觉去了哦。
        }

    }


    public class 加密的文件
    {
        _输入你的加密口令 password = null;
        public readonly int count; public readonly char[] 密码;
       
        public 加密的文件()
        {

        }
        public 加密的文件(string temp)
        {
            if (File.Exists(@temp))
            {
                StreamReader str = new StreamReader(@temp);
                string mytemp = str.ReadToEnd();
                if (mytemp.Length > 0)
                {
                    password = new _输入你的加密口令();
                    count = password.Password.ToString().Length;
                    密码 = new char[count];
                    for (int i = 0; i < count; i++)
                    {
                        密码[i] = (char)password.Password[i];
                        密码[i] ^= 密码[i];

                       
                       
                    }
                   
                   
                   
 
                }

                else
                {
                    Console.WriteLine("文件为空");
                }
               

            }
            else
            {
                throw new FileNotFoundException();
            }

 

        }
    }
    public class MainRun
    {
        static void Main()
        {
           加密的文件 anew = new 加密的文件(@"c:\1.txt");
 
        }
    }
}

posted on 2010-09-17 00:59  胖子黎  阅读(229)  评论(0编辑  收藏  举报

导航