using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;

namespace SCAN.lib
{
    class Cipher
    {
        public static string Hash(byte[] bytes, string stringFormat)
        {
            using (SHA1Managed sha1 = new SHA1Managed())
            {
                var hash = sha1.ComputeHash(bytes);
                var sb = new StringBuilder(hash.Length * 2);

                foreach (byte b in hash)
                {
                    // can be "x2" if you want lowercase
                    sb.Append(b.ToString(stringFormat));
                }

                return sb.ToString();
            }
        }
    }
}
