コード例 #1
0
        async Task addUser(string login, string password, byte level)
        {
            if ((textBoxLogin.TextLength != 0) && (textBoxPassword.TextLength != 0))
            {
                ScryptEncoder encoder     = new ScryptEncoder();
                string        hashedPassw = encoder.Encode(password);
                string[]      lines;
                if (!File.Exists(path))
                {
                    MessageBox.Show("File not found.");
                }
                else
                {
                    lines = File.ReadAllLines(path);
                    if (!checkLogin(lines, login))
                    {
                        using (FileStream fstream = new FileStream(path, FileMode.Append))
                        {
                            byte[] array = System.Text.Encoding.Default.GetBytes(login + ":" + hashedPassw + ":" + level + Environment.NewLine);
                            // асинхронная запись массива байтов в файл
                            await fstream.WriteAsync(array, 0, array.Length);

                            fstream.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Пользователь с таким логином существует.");
                    }
                }
            }
        }
コード例 #2
0
        public ActionResult Login(Users user)
        {
            // Note : Username and Password are same
            ScryptEncoder encoder = new ScryptEncoder();

            // Find the user valid or not, and also check the role is admin or not
            var acc = AllUsers.CheckUser(user.Username, Roles.Admin);

            if (acc != null)
            {
                bool areEquals = false;
                // Compare what u typed with the hashed password which are saved inside the database
                areEquals = encoder.Compare(user.Password, acc.Password);

                // Check the password correct or not
                if (areEquals != false)
                {
                    // After Login, i created two session to store id and username
                    Session["AdminID"]  = acc.ID;
                    Session["Username"] = acc.Username;
                    return(RedirectToAction("Users"));
                }
                else
                {
                    ViewbagError("Invalid Username or Password");
                }
                return(View());
            }
            else
            {
                ViewbagError("Invalid Username or Password");
            }
            return(View());
        }
コード例 #3
0
        public ActionResult ChangePassword(string username, string currentPass, string newPass, string confirmPass)
        {
            if (username == null || currentPass == null || newPass == null || confirmPass == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (newPass != confirmPass)
            {
                TempData["Error"] = "Confirmation password does not match!";
                return(RedirectToAction("ChangePassword"));
            }

            ScryptEncoder encoder     = new ScryptEncoder();
            var           user        = db.Users.Find(username);
            bool          isValidPass = encoder.Compare(currentPass, user.Password);

            if (!isValidPass)
            {
                TempData["Error"] = "Current password is incorrect!";
                return(RedirectToAction("ChangePassword"));
            }


            user.Password = encoder.Encode(newPass);
            if (db.SaveChanges() > 0)
            {
                TempData["SuccessMess"] = "Update successful";
            }
            return(RedirectToAction("ChangePassword"));
        }
コード例 #4
0
        public ActionResult Login(UserModel model)
        {
            ScryptEncoder encoder = new ScryptEncoder();

            try
            {
                var validUser = GetUser(model.UserName);

                if (validUser == null)
                {
                    ViewBag.result = "User email or password is invaild.";
                    return(View());
                }
                bool isValidUser = encoder.Compare(model.UserPassword, validUser.UserPassword);
                if (isValidUser)
                {
                    Session["userName"] = validUser.UserName;
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ViewBag.result = "User email or password is invaild.";
                    return(View());
                }
            }
            catch (Exception e)
            {
                ViewBag.Result = e.Message;
                return(View());
            }
        }
コード例 #5
0
        public ActionResult Logine(Employee_Login employee_Login)
        {
            ViewBag.msg1 = employee_Login.password;
            ScryptEncoder encoder = new ScryptEncoder();

            if (String.IsNullOrEmpty(employee_Login.id) || String.IsNullOrEmpty(employee_Login.password))
            {
                return(View());
            }
            else if (db.Employee_Login.All(x => x.id != employee_Login.id))
            {
                ViewBag.Notification1 = "This employee id " + employee_Login.id + " does not exists";
                return(View());
            }
            var  valid      = (from c in db.Employee_Login where c.id.Equals(employee_Login.id) select c).SingleOrDefault();
            var  checkLogin = db.Employee_Login.Where(x => x.id.Equals(employee_Login.id)).FirstOrDefault();
            bool isvalid    = encoder.Compare(employee_Login.password, valid.password);

            if (checkLogin != null && isvalid == true)
            {
                Session["IdUsSS1"] = employee_Login.id.ToString();
                //TempData["mydata"] =Session["IdUsSS1"];
                return(RedirectToAction("emphome", "Home"));
            }
            else if (employee_Login.password.Length < 6)
            {
                return(View());
            }
            else
            {
                ViewBag.Notification1 = "Incorrect Id or Password";
            }
            return(View());
        }
コード例 #6
0
        public ActionResult Signup(Admin admin)
        {
            ScryptEncoder encoder = new ScryptEncoder();

            if (db.Admins.Any(x => x.UserNameUs == admin.UserNameUs))
            {
                ViewBag.Notification = "This account already exists";
                return(View());
            }
            else if (String.IsNullOrEmpty(admin.UserNameUs) || String.IsNullOrEmpty(admin.PasswordUs) || String.IsNullOrEmpty(admin.RePasswordUs))
            {
                ViewBag.Notification = "Username and password is required";
                return(View());
            }
            else if (admin.PasswordUs != admin.RePasswordUs)
            {
                //ViewBag.Notification = "Password and Repassword does n't match";
                return(View());
            }
            else if (admin.PasswordUs.ToString().Length < 8 || admin.PasswordUs.ToString().Length > 15)
            {
                //ViewBag.Notification = "Password should be minimum 8 characters and less than 15 characters";
                return(View());
            }
            else
            {
                //admin.PasswordUs = encoder.Encode(LoginVM.Password);
                db.Admins.Add(admin);
                db.SaveChanges();
                ViewBag.Notification = "The account has been successfully registered!";
                //Session["IdUsSS"] = tBLUserInfo.IdUs.ToString();
                //Session["UserNameSS"] = tBLUserInfo.UserNameUs.ToString();
                return(RedirectToAction("LoginInfo", "Home"));
            }
        }
コード例 #7
0
        public int AddUser(UserTable users)
        {
            try
            {
                users.UserRole = new List <UserRole>();
                UserRole      roles           = new UserRole();
                ScryptEncoder encoder         = new ScryptEncoder();
                string        encodedPassword = encoder.Encode(users.Password).ToString();
                users.Password = encodedPassword;
                roles.Role     = "Employee";
                roles.UserId   = users.Id;
                users.UserRole.Add(roles);

                foreach (UserRole role in users.UserRole)
                {
                    UserTable user = new UserTable();
                    role.UserId   = users.Id;
                    user.UserName = users.UserName;
                    user.Password = users.Password;
                }
                db.UserTable.Add(users);
                db.SaveChanges();
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(users.Id);
        }
コード例 #8
0
        public ActionResult Login(Admin admin)
        {
            ViewBag.msg1 = admin.PasswordUs;
            if (String.IsNullOrEmpty(admin.UserNameUs) || String.IsNullOrEmpty(admin.PasswordUs))
            {
                return(View());
            }
            ScryptEncoder encoder = new ScryptEncoder();
            var           valid   = (from c in db.Admins where c.UserNameUs.Equals(admin.UserNameUs) select c).SingleOrDefault();

            if (db.Admins.All(x => x.UserNameUs != admin.UserNameUs))
            {
                ViewBag.Message1 = "The username " + admin.UserNameUs + " does not exists";
                return(View());
            }
            bool isvalid = encoder.Compare(admin.PasswordUs, valid.PasswordUs);

            if (valid != null && isvalid == true)
            {
                Session["IdUsSS"]     = admin.IdUs.ToString();
                Session["UserNameSS"] = admin.UserNameUs.ToString();
                return(RedirectToAction("LoginInfo", "Home"));
            }
            else if (admin.PasswordUs.Length < 6)
            {
                return(View());
            }
            else
            {
                ViewBag.Message1 = "Wrong Username or Password";
            }
            return(View());
        }
コード例 #9
0
        public bool Update()
        {
            if (this.NewPassword)
            {
                this.Salt = this.CreateSalt();
                ScryptEncoder encoder = new ScryptEncoder();
                this.Password = encoder.Encode(this.Salt + this.Password);
            }

            string sql = @"UPDATE [dbo].[User]
            SET [username] = @username
               ,[password] = @password
               ,[salt] = @salt
               ,[email] = @email
            WHERE [id] = @id";

            return(Database.Non(sql, new System.Collections.Generic.Dictionary <string, object>
            {
                { "@username", this.Username },
                { "@password", this.Password },
                { "@salt", this.Salt },
                { "@email", this.Email },
                { "@id", this.Id }
            }));
        }
コード例 #10
0
        //zrób validację hasła czy wystarczy
        public Result <User> Add(RegisterUserModel item, bool IsTemporary = false)
        {
            //if (!_userRepository.UserExist(item.Login))
            //{
            int userType = (int)AuthorizationEnum.NormalUser;//normal user

            if (IsTemporary)
            {
                userType = (int)AuthorizationEnum.TemporaryUser;
            }

            if (_userRepository.IsFirstUser())
            {
                userType = (int)AuthorizationEnum.AdminUser; //admin
            }
            ScryptEncoder encoder = new ScryptEncoder();
            User          u       = new User()
            {
                UserTypeId = userType, Password = encoder.Encode(item.Password), Login = item.Login, Email = item.Email, FirstName = item.FirstName, Surname = item.Surname, PhoneNumber = item.PhoneNumber
            };

            return(retWithoutPassword(_userRepository.Add(u)));
            //}
            //var r = new Result<User>();
            //r.info = "taki użytkownik istnieje";
            //r.status = false;
            //return r;
        }
コード例 #11
0
        public ActionResult Register(RegisterViewModel registerViewModel)
        {
            ScryptEncoder      encode  = new ScryptEncoder();
            UserDetailsContext context = new UserDetailsContext();

            if (!ModelState.IsValid)
            {
                return(View("SignUp", registerViewModel));
            }

            var userExistence = context.UserDetails.SingleOrDefault(x => x.Email == registerViewModel.UserDetails.Email);

            if (userExistence != null)
            {
                ViewBag.UserAlreadyExists = "User Already Exists";
                return(View("SignUp", registerViewModel));
            }
            if (registerViewModel.ConfirmPassword != registerViewModel.UserDetails.Password)
            {
                ViewBag.UserAlreadyExists = "Password And Confirm Password Mismatch";
                return(View("SignUp", registerViewModel));
            }
            registerViewModel.UserDetails.Password = encode.Encode(registerViewModel.UserDetails.Password);
            registerViewModel.UserDetails.UserName = "******";
            context.UserDetails.Add(registerViewModel.UserDetails);
            context.SaveChanges();
            // @ViewBag.success = "Account Created Succesfully Login to continue";
            this.AddNotification("Account Created Succesfully Login to continue", NotificationType.SUCCESS);
            return(View("SignUp"));
        }
コード例 #12
0
        public bool Create()
        {
            this.Salt = this.CreateSalt();
            ScryptEncoder encoder = new ScryptEncoder();

            this.Password = encoder.Encode(this.Salt + this.Password);

            string sql = @"INSERT INTO [dbo].[User] ([username],
              [password],
              [salt],
              [email])
            VALUES (
              @username
             ,@password
             ,@salt
             ,@email
            )";

            return(Database.Non(sql, new System.Collections.Generic.Dictionary <string, object>
            {
                { "@username", this.Username },
                { "@password", this.Password },
                { "@salt", this.Salt },
                { "@email", this.Email },
            }));
        }
コード例 #13
0
        public ActionResult SaveData(UserDetails userDetails)
        {
            ScryptEncoder      encode  = new ScryptEncoder();
            UserDetailsContext context = new UserDetailsContext();

            if (!ModelState.IsValid)
            {
                return(View("Index", userDetails));
            }

            UserDetails userExistence = context.UserDetails.SingleOrDefault(x => x.Email == userDetails.Email);



            if (userExistence == null)
            {
                ViewBag.UserAlreadyExists = "User Does Not Exists";
                return(View("Index"));
            }
            else if (!encode.Compare(userDetails.Password, userExistence.Password))
            {
                ViewBag.UserAlreadyExists = "Incorrect Password";
                return(View("Index"));
            }
            else if (encode.Compare(userDetails.Password, userExistence.Password))
            {
                Session["UserId"]   = userExistence.Id;
                Session["Email"]    = userExistence.Email;
                Session["UserName"] = userExistence.UserName;
                ViewBag.msg         = userExistence.UserName;
                return(RedirectToAction("Main", "Home"));
            }
            return(View("Index"));
        }
コード例 #14
0
        private Professionnel Modification(Professionnel initialPro, ProfessionnelsUpdateDTO targetPro)
        {
            ScryptEncoder encoder = new ScryptEncoder();
            var           retour  = initialPro;

            if (targetPro.NomEntreprise != null)
            {
                retour.NomEntreprise = targetPro.NomEntreprise;
            }
            if (targetPro.Adresse != null)
            {
                retour.Adresse = targetPro.Adresse;
            }
            if (targetPro.MotDePasse != null)
            {
                retour.MotDePasse = encoder.Encode(targetPro.MotDePasse);
            }
            if (targetPro.NumeroTel != null)
            {
                retour.NumeroTel = targetPro.NumeroTel;
            }
            if (targetPro.Mail != null)
            {
                retour.Mail = targetPro.Mail;
            }
            if (targetPro.NumeroTVA != null)
            {
                retour.NumeroTVA = targetPro.NumeroTVA;
            }
            if (targetPro.LocaliteCode != null)
            {
                retour.LocaliteCode = targetPro.LocaliteCode;
            }
            return(retour);
        }
コード例 #15
0
        public ActionResult CambiarContraseñaUsers(Password changePass)
        {
            if (ModelState.IsValid)
            {
                ScryptEncoder encoder  = new ScryptEncoder();
                Usuarios      usuarios = db.Usuarios.Find(changePass.idU);

                bool Validar = encoder.Compare(changePass.oldPass, usuarios.hash_password);
                if (Validar)
                {
                    usuarios.hash_password   = encoder.Encode(changePass.newPass);
                    db.Entry(usuarios).State = EntityState.Modified;
                    db.SaveChanges();
                    TempData["Success"] = "¡Contraseña modificada, por favor ingrese nuevamente!";
                    return(RedirectToAction("Cerrar", "Acceso"));
                }
                else
                {
                    ViewBag.Error = "¡Las contraseñas no coinciden!";
                    return(View());
                }
            }

            ViewBag.Error = "¡Ha ocurrido un error, intenta nuevamente!";
            return(View());
        }
コード例 #16
0
        public ActionResult ChangePassword(string username, string currentPass, string newPass, string confirmPass)
        {
            if (username == null || currentPass == null || newPass == null || confirmPass == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ScryptEncoder encoder     = new ScryptEncoder();
            var           user        = db.Users.Find(username);
            bool          isValidPass = encoder.Compare(currentPass, user.Password);

            if (!isValidPass)
            {
                TempData["Current_Pass_Fail"] = true;
                return(RedirectToAction("Index"));
            }
            if (newPass != confirmPass)
            {
                TempData["Password_Not_Match"] = true;
                return(RedirectToAction("Index"));
            }

            user.Password = encoder.Encode(newPass);
            if (db.SaveChanges() > 0)
            {
                TempData["Notice_Save_Success"] = true;
            }
            return(RedirectToAction("Index"));
        }
コード例 #17
0
 public AuthController(ExtensibleDbContext dbCtx)
 {
     _dbCtx        = dbCtx;
     _config       = SystemConfig.LoadConfig();
     _tokenManager = new TokenManager(_dbCtx, _config);
     _scryptHasher = new ScryptEncoder();
 }
コード例 #18
0
        public async Task <IActionResult> Login(string username, string password)
        {
            try
            {
                ScryptEncoder scryptEncoder = new ScryptEncoder();
                usernameStatic = username;
                var admin = await _context.Admins.Where(x => x.AdminName.Equals(username)).FirstOrDefaultAsync();

                bool isAdmin = scryptEncoder.Compare(password, admin.AdminHash);

                if (isAdmin == true)
                {
                    HttpContext.Session.SetString("LoggedInAdmin", admin.AdminId.ToString());
                    return(View("Dashboard"));
                }
                else
                {
                    ViewBag.Error = "Username and password do not match!";
                    return(View());
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                return(View());
            }
        }
コード例 #19
0
        public ActionResult Login(LoginViewModel user)
        {
            ScryptEncoder   encode  = new ScryptEncoder();
            FixesAppContext context = new FixesAppContext();

            if (!ModelState.IsValid)
            {
                // return Content("call");
                return(View("Login", user));
            }

            var userExistence = context.Worker.SingleOrDefault(x => x.MobileNumber == user.MobileNumber);


            if (userExistence == null)
            {
                ViewBag.usernotexist = "User Does Not Exists";
                return(View("Login"));
            }
            else if (!encode.Compare(user.Password, userExistence.Password))
            {
                ViewBag.incorrectpassword = "******";
                return(View("Login"));
            }
            else if (encode.Compare(user.Password, userExistence.Password))
            {
                Session["workerId"] = userExistence.WorkerId;
                // ViewBag.msg = userExistence.UserName;
                Session["Mobile"] = user.MobileNumber;
                return(RedirectToAction("Main", "Worker"));
            }
            return(View("Login"));
        }
コード例 #20
0
        public bool VerifyPassword(string password, string hashedPassword)
        {
            ScryptEncoder encoder = new ScryptEncoder();
            bool          result  = encoder.Compare(password, hashedPassword);

            return(result);
        }
        public ActionResult Login(Users model)
        {
            ScryptEncoder encoder    = new ScryptEncoder();
            string        serviceUrl = string.Format("http://localhost:61866/EmployeeDetails.svc/GetUsers");

            byte[]       _data   = proxy.DownloadData(serviceUrl);
            Stream       _stream = new MemoryStream(_data);
            StreamReader reader  = new StreamReader(_stream);
            string       result  = reader.ReadToEnd();

            users = JsonConvert.DeserializeObject <List <Users> >(result);
            var Users     = users.AsQueryable();
            var ValidUser = (from c in users where c.UserName.Equals(model.UserName) select c).SingleOrDefault();

            if (ValidUser == null)
            {
                ModelState.AddModelError("", "invalid Username or Password");
                return(View());
            }
            bool isValidUser = encoder.Compare(model.Password, ValidUser.Password);

            if (isValidUser)
            {
                FormsAuthentication.SetAuthCookie(model.UserName, false);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Error = "Username or password is invalid";
                return(RedirectToAction("Login"));
            }
        }
コード例 #22
0
        public void TestIsValid()
        {
            var encoder = new ScryptEncoder();

            Assert.False(encoder.IsValid("$e1$adasdasd$asdasdsd"));
            Assert.True(encoder.IsValid(encoder.Encode("MyPassword")));
        }
コード例 #23
0
        public string CreatePasswordHash(string password)
        {
            ScryptEncoder encoder        = new ScryptEncoder();
            string        hashedPassword = encoder.Encode(password);

            return(hashedPassword);
        }
        /// <inheritdoc />
        public PasswordVerificationResult VerifyHashedPassword(TUser user, string hashedPassword, string providedPassword)
        {
            // check inputs
            if (string.IsNullOrEmpty(hashedPassword))
            {
                throw new ArgumentException(nameof(hashedPassword));
            }

            if (string.IsNullOrEmpty(providedPassword))
            {
                throw new ArgumentException(nameof(providedPassword));
            }

            // check password
            ScryptEncoder encoder = new ScryptEncoder();
            bool          isValid = encoder.Compare(providedPassword, hashedPassword);

            // return PasswordVerificationResult based on result of check
            if (isValid)
            {
                return(PasswordVerificationResult.Success);
            }

            return(PasswordVerificationResult.Failed);
        }
コード例 #25
0
        public byte[] CalculatePasswordHash(string password, [CanBeNull] byte[] associatedData = null)
        {
            var encoder = new ScryptEncoder();
            var hash    = encoder.Encode(password);

            return(Encoding.UTF8.GetBytes(hash));
        }
コード例 #26
0
        public ActionResult SignUp(CustomerModel model)
        {
            ScryptEncoder encoder = new ScryptEncoder();

            if (model.Email == null)
            {
                ModelState.AddModelError("Email", "Required");
            }
            if (model.Password == null)
            {
                ModelState.AddModelError("Password", "Required");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    int affectedRows = CustomerRegister(
                        model.FirstName,
                        model.LastName,
                        model.Address,
                        model.City,
                        model.Province,
                        model.Postal,
                        model.Country,
                        model.HomePhone,
                        model.BusinessPhone,
                        model.Email,
                        encoder.Encode(model.Password)
                        );
                    if (affectedRows > 0)
                    {
                        ViewBag.Result = "Registered successfully. You can login now.";
                        return(View());
                    }
                    else
                    {
                        ViewBag.result = "The email address is already registered.";
                    }
                }
                catch (Exception e)
                {
                    ViewBag.Result = e.Message;
                }
            }

            List <Country> CountryList = LoadCountry();

            ViewBag.CountryList = new SelectList(CountryList, "CountryName", "CountryName");

            if (model.Country != null)
            {
                List <Province> ProvinceList = LoadProvince(model.Country);
                ViewBag.ProvinceList = new SelectList(ProvinceList, "ProvAbbr", "ProvName");
            }
            model.Password        = null;
            model.ConfirmPassword = null;
            return(View(model));
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: blockspacer/HazelTest
        /// <summary>
        /// Start this instance.
        /// </summary>
        public void Start()
        {
            //https://stackoverflow.com/questions/2586612/how-to-keep-a-net-console-app-running
            Console.CancelKeyPress += (sender, eArgs) =>
            {
                _quitEvent.Set();
                eArgs.Cancel = true;
            };

            //Connect and create users collection for LiteDB.org
            //Get users collection
            var col = db.GetCollection <Users>("users");

            if (col.Count() == 0)
            {
                ScryptEncoder encoder         = new ScryptEncoder();
                string        hashsedPassword = encoder.Encode("test1234!");
                //Console.WriteLine(hashsedPassword);
                //Same password
                //string hashsedPassword2 = encoder.Encode("test1234!");
                //Console.WriteLine(hashsedPassword);
                // Create your new customer instance
                var user = new Users
                {
                    UserName     = "******",
                    UserPassword = hashsedPassword,
                    IsActive     = true
                };

                // Create unique index in Name field
                col.EnsureIndex(x => x.UserName, true);

                // Insert new customer document (Id will be auto-incremented)
                col.Insert(user);
            }

            NetworkEndPoint    endPoint = new NetworkEndPoint(IPAddress.Any, portNumber);
            ConnectionListener listener = new UdpConnectionListener(endPoint);

            Running = true;

            Console.WriteLine("Starting server!");
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;

            Console.WriteLine("Server Version: " + version);
            Console.WriteLine("BD file path: " + Path.Combine(AssemblyDirectory, @"UsersObjects.db"));
            Console.WriteLine("Server listening on " + (listener as UdpConnectionListener).EndPoint);
            listener.NewConnection += NewConnectionHandler;
            listener.Start();

            _quitEvent.WaitOne();

            //Close all
            listener.Close();
            //Exit 0
            Environment.Exit(0);
        }
コード例 #28
0
        public void TestCompare()
        {
            var encoder        = new ScryptEncoder();
            var hashedPassword = encoder.Encode("MyPassword");

            Assert.True(encoder.Compare("MyPassword", hashedPassword));
            Assert.False(encoder.Compare("WrongPassword", hashedPassword));
        }
コード例 #29
0
        public bool VerifyPasswordHash(string password, [NotNull] byte[] storedHash)
        {
            var hashString = Encoding.UTF8.GetString(storedHash);

            var encoder = new ScryptEncoder();

            return(encoder.Compare(password, hashString));
        }
コード例 #30
0
ファイル: Hash.cs プロジェクト: SyntaxCheck/SynUtil
        /// <summary>
        /// This hash function will auto generate a salt. Each call to the function will result in a different value. Need to use the ScryptIsMatch Method
        /// </summary>
        /// <param name="toHash"></param>
        /// <returns></returns>
        public static string Scrypt(string toHash)
        {
            ScryptEncoder encod = new ScryptEncoder();

            string hash = encod.Encode(toHash);

            return(hash);
        }