Example #1
0
        public void StringCrypt_Basic_Implicit()
        {
            string input = "test 123 %$#";

            byte[] output      = StringCrypt.Encrypt(input);
            string outputFinal = StringCrypt.Decrypt(output);

            Assert.AreEqual(input, outputFinal, "String output should be as exected after decrypt.");
        }
Example #2
0
    public static void SetLogin()
    {
        var Cookie = new HttpCookie(
            "U",
            StringCrypt.Encrypt(Convert.ToBase64String(StringCrypt.GetSHA1(HttpContext.Current.Request.UserAgent + HttpContext.Current.Request.UserHostAddress)), "eri01268")
            );

        Cookie.HttpOnly = true;
        HttpContext.Current.Response.Cookies.Add(Cookie);
    }