BgEngine.Infraestructure.Security.CodeFirstCrypto.Hash C# (CSharp) Метод

Hash() публичный статический Метод

public static Hash ( byte input, string algorithm = "sha256" ) : string
input byte
algorithm string
Результат string
        public static string Hash(byte[] input, string algorithm = "sha256")
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            using (HashAlgorithm alg = HashAlgorithm.Create(algorithm))
            {
                if (alg != null)
                {
                    byte[] hashData = alg.ComputeHash(input);
                    return BinaryToHex(hashData);
                }
                else
                {
                    throw new InvalidOperationException(String.Format(string.Format("Not supported hash algorhitm {0}", algorithm)));
                }
            }
        }

Same methods

CodeFirstCrypto::Hash ( string input, string algorithm = "sha256" ) : string