byte array To MD Hash - CSharp System

CSharp examples for System:Byte Array

Description

byte array To MD Hash

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Security.Cryptography;
using System.Linq;
using System.Collections.Generic;
using System;//w w w  .  j a v  a 2s .  c  o  m

public class Main{
        public static string ToMD5Hash(this byte[] target) {
            if (null == target)
                throw new ArgumentNullException("target");

            var md5 = MD5.Create();
            var hashInBytes = md5.ComputeHash(target);
            return Convert.ToBase64String(hashInBytes);
        }
}

Related Tutorials