Advertisement
sLowDowN

Untitled

Nov 13th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Security.Cryptography;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Forms;
  8. using System.IO;
  9.  
  10.  
  11. namespace vHack.data
  12. {
  13.     public static class Encode
  14.     {
  15.         static string url = "https://api.vhack.cc/v/4/";
  16.         static string secret = "aeffI";
  17.         static byte[] base64Alphabet = new byte[] { (byte)65, (byte)66, (byte)67, (byte)68, (byte)69, (byte)70, (byte)71, (byte)72, (byte)73, (byte)74, (byte)75, (byte)76, (byte)77, (byte)78, (byte)79, (byte)80, (byte)81, (byte)82, (byte)83, (byte)84, (byte)85, (byte)86, (byte)87, (byte)88, (byte)89, (byte)90, (byte)97, (byte)98, (byte)99, (byte)100, (byte)101, (byte)102, (byte)103, (byte)104, (byte)105, (byte)106, (byte)107, (byte)108, (byte)109, (byte)110, (byte)111, (byte)112, (byte)113, (byte)114, (byte)115, (byte)116, (byte)117, (byte)118, (byte)119, (byte)120, (byte)121, (byte)122, (byte)48, (byte)49, (byte)50, (byte)51, (byte)52, (byte)53, (byte)54, (byte)55, (byte)56, (byte)57, (byte)45, (byte)95 };
  18.  
  19.  
  20.         private static byte[] m9179a(byte[] bArr, int i, int i2, byte[] bArr2, int i3, byte[] bArr3)
  21.         {
  22.             int i4 = 0;
  23.             int i5 = (i2 > 1 ? (bArr[i + 1] << 24) >> 16 : 0) | (i2 > 0 ? (bArr[i] << 24) >> 8 : 0);
  24.             if (i2 > 2)
  25.             {
  26.                 i4 = (bArr[i + 2] << 24) >> 24;
  27.             }
  28.             i4 |= i5;
  29.             switch (i2)
  30.             {
  31.                 case 1 /*1*/:
  32.                     bArr2[i3] = bArr3[i4 >> 18];
  33.                     bArr2[i3 + 1] = bArr3[(i4 >> 12) & 63];
  34.                     bArr2[i3 + 2] = (byte)61;
  35.                     bArr2[i3 + 3] = (byte)61;
  36.                     break;
  37.                 case 2 /*2*/:
  38.                     bArr2[i3] = bArr3[i4 >> 18];
  39.                     bArr2[i3 + 1] = bArr3[(i4 >> 12) & 63];
  40.                     bArr2[i3 + 2] = bArr3[(i4 >> 6) & 63];
  41.                     bArr2[i3 + 3] = (byte)61;
  42.                     break;
  43.                 case 3 /*3*/:
  44.                     bArr2[i3] = bArr3[i4 >> 18];
  45.                     bArr2[i3 + 1] = bArr3[(i4 >> 12) & 63];
  46.                     bArr2[i3 + 2] = bArr3[(i4 >> 6) & 63];
  47.                     bArr2[i3 + 3] = bArr3[i4 & 63];
  48.                     break;
  49.             }
  50.             return bArr2;
  51.         }
  52.  
  53.         public static string m9177a(byte[] bArr, int i, int i2, byte[] bArr2)
  54.         {
  55.             byte[] a = m9178a(bArr, i, i2, bArr2, 2147483647);
  56.             int length = a.Length;
  57.             while (length > 0 && a[length - 1] == 61)
  58.             {
  59.                 length--;
  60.             }
  61.             return Encoding.UTF8.GetString(a, 0, length);
  62.         }
  63.  
  64.         public static string m9175a(string str)
  65.         {
  66.             try
  67.             {
  68.                 byte[] bytes = Encoding.UTF8.GetBytes(str);
  69.                 MD5 md5 = new MD5CryptoServiceProvider();
  70.                 byte[] result = md5.ComputeHash(bytes);
  71.                 StringBuilder stringBuilder = new StringBuilder();
  72.                 foreach (byte b in result)
  73.                 {
  74.                     string toHexString = (b & 255).ToString("x2");
  75.                     while (toHexString.Length < 2)
  76.                     {
  77.                         toHexString = "0" + toHexString;
  78.                     }
  79.                     stringBuilder.Append(toHexString);
  80.                 }
  81.                 return stringBuilder.ToString();
  82.             }
  83.             catch (Exception)
  84.             {
  85.                 return "";
  86.             }
  87.         }
  88.  
  89.         public static byte[] m9178a(byte[] bArr, int i, int i2, byte[] bArr2, int i3)
  90.         {
  91.             int i4 = ((i2 + 2) / 3) * 4;
  92.             byte[] bArr3 = new byte[(i4 + (i4 / i3))];
  93.             int i5 = i2 - 2;
  94.             int i6 = 0;
  95.             int i7 = 0;
  96.             int i8 = 0;
  97.             while (i8 < i5)
  98.             {
  99.                 i4 = (((bArr[i8 + i] << 24) >> 8) | ((bArr[(i8 + 1) + i] << 24) >> 16)) | ((bArr[(i8 + 2) + i] << 24) >> 24);
  100.                 bArr3[i7] = bArr2[i4 >> 18];
  101.                 bArr3[i7 + 1] = bArr2[(i4 >> 12) & 63];
  102.                 bArr3[i7 + 2] = bArr2[(i4 >> 6) & 63];
  103.                 bArr3[i7 + 3] = bArr2[i4 & 63];
  104.                 i4 = i6 + 4;
  105.                 if (i4 == i3)
  106.                 {
  107.                     bArr3[i7 + 4] = (byte)10;
  108.                     i7++;
  109.                     i4 = 0;
  110.                 }
  111.                 i8 += 3;
  112.                 i7 += 4;
  113.                 i6 = i4;
  114.             }
  115.             if (i8 < i2)
  116.             {
  117.                 m9179a(bArr, i8 + i, i2 - i8, bArr3, i7, bArr2);
  118.                 if (i6 + 4 == i3)
  119.                 {
  120.                     bArr3[i7 + 4] = (byte)10;
  121.                     i7++;
  122.                 }
  123.                 i7 += 4;
  124.             }
  125.             return bArr3;
  126.         }
  127.  
  128.         public static string m9176a(string pattern, string str2, string str3)
  129.         {
  130.             string[] splitstring = new string[] { "::::" };
  131.             string[] split = pattern.Split(splitstring, StringSplitOptions.None);
  132.             string[] split2 = str2.Split(splitstring, StringSplitOptions.None);
  133.             long currentTimeMillis = (long)(getCurrentTimeMillis() / 1000);
  134.             string str4 = "{";
  135.  
  136.             for (int i = 0; i < split.Length; i++)
  137.             {
  138.                 str4 += "\"" + split[i] + "\":\"" + split2[i] + "\",";
  139.             }
  140.             str4 += "\"time\":\"" + currentTimeMillis + "\"}";
  141.  
  142.             byte[] bytes = Encoding.UTF8.GetBytes(str4);
  143.             string a = m9177a(bytes, 0, bytes.Length, base64Alphabet);
  144.             string a2 = m9175a(str4.Length + m9175a(currentTimeMillis + ""));
  145.             string str5 = split2[0] + "" + m9175a(m9175a(split2[1]));
  146.             str4 = m9175a(currentTimeMillis + "" + str4);
  147.             byte[] bytes2 = Encoding.UTF8.GetBytes(a2);
  148.             byte[] bytes3 = Encoding.UTF8.GetBytes(str5);
  149.             byte[] bytes4 = Encoding.UTF8.GetBytes(str4);
  150.             a2 = m9175a(secret + m9175a(m9175a(m9177a(bytes2, 0, bytes2.Length, base64Alphabet))));
  151.             str5 = m9177a(bytes3, 0, bytes3.Length, base64Alphabet);
  152.             str4 = m9175a(m9175a(a2 + m9175a(m9175a(str5) + m9177a(bytes4, 0, bytes4.Length, base64Alphabet))));
  153.             return url + str3 + "?user=" + a + "&pass=" + str4;
  154.         }
  155.  
  156.         public static double getCurrentTimeMillis()
  157.         {
  158.             DateTime Jan1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
  159.             TimeSpan javaSpan = DateTime.UtcNow - Jan1970;
  160.             return javaSpan.TotalMilliseconds;
  161.         }
  162.  
  163.     }
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement