Example #1
0
        public virtual string GenerateSalted(string plainText, string salt)
        {
            byte[] saltBytes = Convert.FromBase64String(salt);

            byte[] plainTextBytes = Encoding.ASCII.GetBytes(plainText);

            byte[] plainTextWithSaltBytes = CryptoHelper.AppendByteArray(plainTextBytes, saltBytes);

            byte[] saltedSHA1Bytes = _algorithm.ComputeHash(plainTextWithSaltBytes);

            byte[] saltedSHA1WithAppendedSaltBytes = CryptoHelper.AppendByteArray(saltedSHA1Bytes, saltBytes);

            return(Convert.ToBase64String(saltedSHA1WithAppendedSaltBytes));
        }