private NewPassword HashPassword(NewPassword np) { HashAlgorithm hashAlg = null; try { hashAlg = new SHA256CryptoServiceProvider(); byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(np.GetSaltPassword()); byte[] bytHash = hashAlg.ComputeHash(bytValue); np.SaltedHashedPassword = Convert.ToBase64String(bytHash); } catch (Exception e) { throw e; } finally { if (hashAlg != null) { hashAlg.Clear(); hashAlg.Dispose(); hashAlg = null; } } return(np); }