Пример #1
0
        public (string HashBase64, string SaltBase64) Hash(string password)
        {
            var salt = new byte[SALT_SIZE];

            new RNGCryptoServiceProvider().GetBytes(salt);
            var hash = new Rfc2898DeriveBytes(password, salt, HASH_ITERATIONS).GetBytes(HASH_SIZE);

            return(Convert.ToBase64String((byte[])hash.Clone()), Convert.ToBase64String((byte[])salt.Clone()));
        }