Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ElinEncoder Class Reference

Static Public Member Functions

static string AesEncrypt (string srcStr)
 
static string AesDecrypt (string encStr)
 
static string GetCode (int idBacker, int index)
 
static string GetID (string code)
 
static bool IsValid (string code)
 

Static Private Attributes

const string key = "123456789012345678901234"
 
const string iv = "12345678"
 

Detailed Description

Definition at line 6 of file ElinEncoder.cs.

Member Function Documentation

◆ AesDecrypt()

static string ElinEncoder.AesDecrypt ( string  encStr)
inlinestatic

Definition at line 25 of file ElinEncoder.cs.

26 {
27 TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
28 byte[] array = Convert.FromBase64String(encStr);
29 MemoryStream memoryStream = new MemoryStream();
30 CryptoStream cryptoStream = new CryptoStream(memoryStream, tripleDESCryptoServiceProvider.CreateDecryptor(Encoding.UTF8.GetBytes("123456789012345678901234"), Encoding.UTF8.GetBytes("12345678")), CryptoStreamMode.Write);
31 cryptoStream.Write(array, 0, array.Length);
32 cryptoStream.Close();
33 byte[] bytes = memoryStream.ToArray();
34 memoryStream.Close();
35 return Encoding.UTF8.GetString(bytes);
36 }

Referenced by GetID(), and IsValid().

◆ AesEncrypt()

static string ElinEncoder.AesEncrypt ( string  srcStr)
inlinestatic

Definition at line 12 of file ElinEncoder.cs.

13 {
14 TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
15 byte[] bytes = Encoding.UTF8.GetBytes(srcStr);
16 MemoryStream memoryStream = new MemoryStream();
17 CryptoStream cryptoStream = new CryptoStream(memoryStream, tripleDESCryptoServiceProvider.CreateEncryptor(Encoding.UTF8.GetBytes("123456789012345678901234"), Encoding.UTF8.GetBytes("12345678")), CryptoStreamMode.Write);
18 cryptoStream.Write(bytes, 0, bytes.Length);
19 cryptoStream.Close();
20 byte[] inArray = memoryStream.ToArray();
21 memoryStream.Close();
22 return Convert.ToBase64String(inArray);
23 }

Referenced by GetCode().

◆ GetCode()

static string ElinEncoder.GetCode ( int  idBacker,
int  index 
)
inlinestatic

Definition at line 38 of file ElinEncoder.cs.

39 {
40 return AesEncrypt(idBacker.ToString("0000") + index).TrimEnd('=');
41 }
static string AesEncrypt(string srcStr)
Definition: ElinEncoder.cs:12

References AesEncrypt().

◆ GetID()

static string ElinEncoder.GetID ( string  code)
inlinestatic

Definition at line 43 of file ElinEncoder.cs.

44 {
45 return AesDecrypt(code + "=");
46 }
static string AesDecrypt(string encStr)
Definition: ElinEncoder.cs:25

References AesDecrypt().

Referenced by UI.ToggleFeedback().

◆ IsValid()

static bool ElinEncoder.IsValid ( string  code)
inlinestatic

Definition at line 48 of file ElinEncoder.cs.

49 {
50 try
51 {
52 int result;
53 return int.TryParse(AesDecrypt(code + "="), out result);
54 }
55 catch
56 {
57 }
58 return false;
59 }

References AesDecrypt().

Referenced by CoreConfig.HasBackerRewardCode(), and ContentConfigOther.OpenBackerCodeInput().

Member Data Documentation

◆ iv

const string ElinEncoder.iv = "12345678"
staticprivate

Definition at line 10 of file ElinEncoder.cs.

◆ key

const string ElinEncoder.key = "123456789012345678901234"
staticprivate

Definition at line 8 of file ElinEncoder.cs.


The documentation for this class was generated from the following file: