Пример #1
0
        private static string EncodePassword(string password, PasswordEncoding encoding)
        {
            if (encoding != PasswordEncoding.Hashed)
            {
                throw new BusiBlocksException("Password format not valid");
            }

            var sha1CryptoService = new SHA1CryptoServiceProvider();

            byte[] byteValue = Encoding.UTF8.GetBytes(password);
            byte[] hashValue = sha1CryptoService.ComputeHash(byteValue);

            return(Convert.ToBase64String(hashValue));
        }
Пример #2
0
        private static string EncodePassword(string password, PasswordEncoding encoding)
        {
            if (encoding != PasswordEncoding.Hashed)
                throw new EucalyptoException("Password format not valid");

            System.Security.Cryptography.SHA1CryptoServiceProvider sha1CryptoService = new System.Security.Cryptography.SHA1CryptoServiceProvider();
            byte[] byteValue = Encoding.UTF8.GetBytes(password);
            byte[] hashValue = sha1CryptoService.ComputeHash(byteValue);

            return System.Convert.ToBase64String(hashValue);
        }