• 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");
     
            }
        }
    }

  • 相关阅读:
    算法
    Unity-UI
    lua-设计与实现 1类型
    Unity-Cache Server
    lua-高效编程-总结
    算法-JPS寻路设计思想
    数据结构- List、Dictionary
    数据结构-二叉树、堆
    VSCode更好用
    功能快捷键
  • 原文地址:https://www.cnblogs.com/fat_li/p/1828573.html
Copyright © 2020-2023  润新知