Ejemplo n.º 1
0
        public static bool CompareHashValue(string password, string username, string OldHASHValue, byte[] SALT)
        {
            try
            {
                string expectedHashString = GenerateHASHValue.GenerateHASH(password, username, SALT);

                return(OldHASHValue == expectedHashString);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,user_Name,user_passWord,user_FirstName,User_LastName,user_email,user_registered_Date,Activity,display_name,User_Image,User_Address,User_Country,User_PostalCode,User_Abouts")] user_Credential user_Credential)
        {
            if (ModelState.IsValid)
            {
                //Generate Hash
                byte[] _solt     = GenerateSaltKey.GenerateSALT(GenerateSaltKey._SaltLengthLimit);
                string _hashCode = GenerateHASHValue.GenerateHASH(user_Credential.user_Name, user_Credential.user_passWord, _solt);

                user_Credential.HASH = _hashCode;
                user_Credential.SALT = _solt;

                ///Fill
                db.user_Credential.Add(user_Credential);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user_Credential));
        }