Пример #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); });
        }