hytos / ID2.Manager / ID2.Manager.Common / Globals.cs @ 4013fbc5
이력 | 보기 | 이력해설 | 다운로드 (1.53 KB)
1 | 35d01ef5 | yoush97 | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | using System.Security.Cryptography; |
||
8 | |||
9 | namespace ID2.Manager.Common |
||
10 | { |
||
11 | public class Globals |
||
12 | { |
||
13 | private static Globals m_Globals; |
||
14 | |||
15 | public static Globals GetInstance |
||
16 | { |
||
17 | get |
||
18 | { |
||
19 | if (m_Globals == null) |
||
20 | { |
||
21 | m_Globals = new Globals(); |
||
22 | } |
||
23 | |||
24 | return m_Globals; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | public static string Name |
||
29 | { |
||
30 | get |
||
31 | { |
||
32 | 947e6939 | yoush97 | return "ID2Manater"; |
33 | 35d01ef5 | yoush97 | } |
34 | } |
||
35 | |||
36 | public static string EncryptionSHA256(string Data) |
||
37 | { |
||
38 | using (SHA256 sha = new SHA256Managed()) |
||
39 | { |
||
40 | return Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(Data))); |
||
41 | |||
42 | } |
||
43 | } |
||
44 | |||
45 | public static string Base64Encoding(string EncodingText, System.Text.Encoding oEncoding = null) |
||
46 | { |
||
47 | if (oEncoding == null) |
||
48 | oEncoding = System.Text.Encoding.UTF8; |
||
49 | |||
50 | byte[] arr = oEncoding.GetBytes(EncodingText); |
||
51 | return System.Convert.ToBase64String(arr); |
||
52 | } |
||
53 | |||
54 | public static byte[] Base64Decoding(string DecodingText, System.Text.Encoding oEncoding = null) |
||
55 | { |
||
56 | if (oEncoding == null) |
||
57 | oEncoding = System.Text.Encoding.UTF8; |
||
58 | |||
59 | byte[] arr = System.Convert.FromBase64String(DecodingText); |
||
60 | return arr; |
||
61 | } |
||
62 | } |
||
63 | } |