프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Common / Globals.cs @ 4013fbc5

이력 | 보기 | 이력해설 | 다운로드 (1.53 KB)

1
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
                return "ID2Manater";
33
            }
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
}
클립보드 이미지 추가 (최대 크기: 500 MB)