/* * Habbo V26 Encryption * http://tracescript.net || http://script-o-matic.net * Cracked by: Stephen(Totov) and Matthew Parlane * Ported by: Mike (Office.Boy) */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace V26_Encryption { class Encryption_8574 { int[] key = new int[256]; int[] table = new int[256]; int q; int j; public Encryption_8574(int[] tOtherKey) { // Reset j this.j = 0; // Call init this.init(tOtherKey); // Premix the table this.premixTable("NV6VVFPoC7FLDlzDUri3qcOAg9cRoFOmsYR9ffDGy5P8HfF6eekX40SFSVfJ1mDb3lcpYRqdg28sp61eHkPukKbqTu1JsVEKiRavi04YtSzUsLXaYSa5BEGwg5G2OF", 52); } private void init(int[] tKey) { // This has fucking changed loads.. int[] tXorVals = { 109, 87, 120, 70, 82, 74, 110, 71, 74, 53, 84, 57, 83, 105, 48, 79, 77, 86, 118, 69, 66, 66, 109, 56, 108, 97, 105, 104, 88, 107, 78, 56, 71, 109, 72, 54, 102, 117, 118, 55, 108, 100, 90, 104, 76, 121, 71, 82, 82, 75, 67, 99, 71, 122, 122, 105, 80, 89, 66, 97, 74, 111, 109 }; List tModKey = new List(); int k; int tVal; int l = 1; for (k = 1; k <= tKey.Count(); k++) { tVal = (tKey[k - 1] ^ tXorVals[l - 1]); tModKey.Add(tVal); l = (l + 1); if (l > tXorVals.Count()) { l = 1; } } for (q = 0; q <= 255; q++) { this.key[q] = tModKey[((q % (tModKey.Count)))]; this.table[q] = q; } // Reset j j = 0; for (q = 0; q <= 255; q++) { this.j = (((this.j + this.table[this.q]) + this.key[this.q]) % 256); k = this.table[this.q]; this.table[this.q] = this.table[this.j]; this.table[this.j] = k; } // Reset q and j this.q = 0; this.j = 0; } private int moveUp() { int swap; int t_i; int t2_i; int t_j; int t2_j; this.q = ((q + 1) % 256); this.j = ((j + this.table[q]) % 256); swap = table[q]; table[q] = table[j]; table[j] = swap; t_i = ((17 * (q + 19)) % 256); t_j = ((j + table[t_i]) % 256); swap = table[t_i]; table[t_i] = table[t_j]; table[t_j] = swap; if (((q == 46) || (q == 67)) || (q == 192)) { t2_i = ((297 * (t_i + 67)) % 256); t2_j = ((t_j + table[t2_i]) % 256); swap = table[t2_i]; table[t2_i] = table[t2_j]; table[t2_j] = swap; } int tmp = table[(table[q] + table[j]) % 256]; return tmp; } public string encipher(string theData) { StringBuilder ciphered = new StringBuilder(); foreach (Char character in theData) { ciphered.Append(((int)character ^ moveUp()).ToString("X")); } premixTable("xllVGKnnQcW8aX4WefdKrBWTqiW5EwT", 1); return ciphered.ToString(); } public string decipher(string theData) { StringBuilder decipher = new StringBuilder(); for (int i = 0; i < theData.Length; i = i + 2) { String hexChars = theData.Substring(i, 2); decipher.Append(Convert.ToChar(int.Parse(hexChars, System.Globalization.NumberStyles.HexNumber) ^ moveUp())); } premixTable("xllVGKnnQcW8aX4WefdKrBWTqiW5EwT", 1); return decipher.ToString(); } public void premixTable(string datain, int count) { for (int a = 0; a < count; a++) { this.encipher(datain); } } } }