示例#1
0
        public static string Decrypt(string str, UInt16 uiseed = 1)
        {
            if (str == null)
            {
                return(null);
            }

            char seed = (char)uiseed;
            char c;

            char[] array = str.ToCharArray();
            Array.Reverse(array);

            int i = array.Length - 1;

            for (; i > 0; i--)
            {
                c            = array[i];
                array[i]     = array[i - 1];
                array[i - 1] = c;

                array[i] = AED0x1.Sub(array[i], array[i - 1]);
            }

            array[i] = AED0x1.Sub(array[i], seed);



            return(new string(array));
        }
示例#2
0
        public static string Encrypt(string str, UInt16 uiseed = 1)
        {
            if (str == null)
            {
                return(null);
            }

            char seed = (char)uiseed;
            char c;

            char[] array = str.ToCharArray();
            int    i     = 0;

            for (; i < array.Length - 1; i++)
            {
                c            = array[i];
                array[i]     = array[i + 1];
                array[i + 1] = c;

                array[i] = AED0x1.Add(array[i], array[i + 1]);
                array[i] = AED0x1.Add(array[i], seed);
            }

            array[i] = AED0x1.Add(array[i], seed);


            Array.Reverse(array);
            return(new string(array));
        }
示例#3
0
 public static string Decrypt(SecureString str, UInt16 uiseed = 1)
 {
     return(AED0x1.Decrypt(str.Release(), uiseed));
 }
示例#4
0
 public static SecureString DecryptSecure(string str, UInt16 uiseed = 1)
 {
     return(AED0x1.Decrypt(str, uiseed).Secure());
 }
示例#5
0
 public static SecureString EncryptSecure(SecureString str, UInt16 uiseed = 1)
 {
     return(AED0x1.Encrypt(str.Release(), uiseed).Secure());
 }