示例#1
0
        public void Test_Complex()
        {
            const string pw    = "test password";
            string       crypt = SCCrypt.scEncrypt(pw, unchecked ((ushort)SysUtils.CrcStr("test")));
            string       pw1   = SCCrypt.scDecrypt(crypt, unchecked ((ushort)SysUtils.CrcStr("test")));

            Assert.AreEqual(pw, pw1, "SCCrypt_Test");

            byte[] salt = SCCrypt.CreateRandomSalt(24);
            Assert.IsNotNull(salt);
            Assert.AreEqual(24, salt.Length);

            SCCrypt.ClearBytes(salt);
            Assert.Throws(typeof(ArgumentNullException), () => { SCCrypt.ClearBytes(null); });
        }
示例#2
0
        public void SaveToFile(IniFile iniFile)
        {
            if (iniFile == null)
            {
                throw new ArgumentNullException("iniFile");
            }

            iniFile.WriteBool("Proxy", "UseProxy", UseProxy);
            iniFile.WriteString("Proxy", "Server", Server);
            iniFile.WriteString("Proxy", "Port", Port);
            iniFile.WriteString("Proxy", "Login", Login);

            string pw = SCCrypt.scEncrypt(Password, unchecked ((ushort)CRC32.CrcStr("GEDKeeper")));

            iniFile.WriteString("Proxy", "Password", pw);
        }