■ SHA256Managed 클래스 : SHA256 해시값 구하기

----------------------------------------------------------------------------------------------------

using System;

using System.Text;

using System.Security.Cryptography;

 

#region SHA256 해시값 구하기 - GetSHA256Hash(plainText)

 

/// <summary>

/// SHA256 해시값 구하기

/// </summary>

/// <param name="plainText">평문 텍스트</param>

/// <returns>SHA256 해시값</returns>

public string GetSHA256Hash(string plainText)

{

    SHA256 sha = new SHA256Managed();

 

    byte[] hashArray = sha.ComputeHash(Encoding.ASCII.GetBytes(plainText));

 

    string hashText = Convert.ToBase64String(hashArray);

 

    return hashText;

}

 

#endregion

----------------------------------------------------------------------------------------------------

 

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요