markus / MarkusLogview / MARKUS_LOGVIEW / Common / CryptoHelper.cs @ 605adc4b
이력 | 보기 | 이력해설 | 다운로드 (596 Bytes)
1 | 84578b97 | djkim | using System; |
---|---|---|---|
2 | using System.IO; |
||
3 | using System.Security.Cryptography; |
||
4 | using System.Text; |
||
5 | |||
6 | namespace MARKUS_LOGVIEW.Common |
||
7 | { |
||
8 | public static class CryptoHelper |
||
9 | { |
||
10 | public static string SHA256Hash(string data) |
||
11 | { |
||
12 | SHA256 sha = new SHA256Managed(); |
||
13 | byte[] hash = sha.ComputeHash(Encoding.ASCII.GetBytes(data)); |
||
14 | StringBuilder stringBuilder = new StringBuilder(); |
||
15 | foreach(byte b in hash) |
||
16 | { |
||
17 | stringBuilder.AppendFormat("{0:x2}", b); |
||
18 | } |
||
19 | return stringBuilder.ToString(); |
||
20 | } |
||
21 | } |
||
22 | } |