private static int DecryptRoomsCountFull() { try { string lengthString = GetKeyValue("Vlera2"); string keyFull = GetKeyValue(path, name); int length = Convert.ToInt32(lengthString); Encoding ascii = Encoding.ASCII; int nr; // Bejme deshifrimin e numrit te dhomave qe jane ne program string nrDhomash = keyFull.Substring(keyFull.Length - length, length); string nrDhomashDec = ""; Byte[] encodedRoomCount = ascii.GetBytes(nrDhomash); foreach (Byte b in encodedRoomCount) { nr = Algebra.GetIndex(Convert.ToChar(b)); // Bejme kete veprim: ((nr + 6) / 8) - 9 nr = Algebra.Substract(Algebra.Divide(Algebra.Sum(nr, 6, 59), 8, 59), 9, 59); nrDhomashDec += Algebra.GetChar(nr).ToString(); } return(Convert.ToInt32(nrDhomashDec)); } catch { return(0); } }
/// <summary> /// Ben deshifrimin e numrit serial qe eshte i ruajtur ne rregjistra nga versioni i plote ne /// versionin DEMO /// </summary> /// <returns>numrin serial te deshifruar</returns> private static string DecryptKeyFull() { try { int length = Convert.ToInt32(GetKeyValue("Vlera2")); string keyFull = GetKeyValue(path, name); Encoding ascii = Encoding.ASCII; int nr; // Bejme deshifrimin e numrit te dhomave qe jane ne program string nrDhomash = keyFull.Substring(keyFull.Length - length, length); string nrDhomashDec = ""; Byte[] encodedRoomCount = ascii.GetBytes(nrDhomash); foreach (Byte b in encodedRoomCount) { nr = Algebra.GetIndex(Convert.ToChar(b)); // Bejme kete veprim: ((nr + 6) / 8) - 9 nr = Algebra.Substract(Algebra.Divide(Algebra.Sum(nr, 6, 59), 8, 59), 9, 59); nrDhomashDec += Algebra.GetChar(nr).ToString(); } // Bejme deshifrimin e kohes se ngarkimit te sistemit string loadedSystemTime = keyFull.Substring(keyFull.Length - (4 + length), 4); string systemTimeDec = ""; Byte[] systemTime = ascii.GetBytes(loadedSystemTime); foreach (Byte b in systemTime) { nr = Algebra.GetIndex(Convert.ToChar(b)); // Bejme kete veprim: ((nr + 8) / 3) - 15 nr = Algebra.Substract(Algebra.Divide(Algebra.Sum(nr, 6, 59), 3, 59), 15, 59); systemTimeDec += Algebra.GetChar(nr).ToString(); } // Bejme deshifrimin e numrit serial te sistemit string systemSerial = keyFull.Substring(0, 10); string systemSerialDec = ""; Byte[] encodedSystemSerial = ascii.GetBytes(systemSerial); foreach (Byte b in encodedSystemSerial) { nr = Algebra.GetIndex(Convert.ToChar(b)); // Bejme kete veprim: ((nr - 7) / 10) + 2 nr = Algebra.Sum(Algebra.Divide(Algebra.Substract(nr, 7, 59), 10, 59), 2, 59); systemSerialDec += Algebra.GetChar(nr).ToString(); } // Bejme deshifrimin e numrit serial te hard diskut string hardDiskSerial = keyFull.Substring(10, keyFull.Length - (4 + length + 10)); string hardDiskSerialDec = ""; Byte[] encodedHDSerial = ascii.GetBytes(hardDiskSerial); int i = 0; foreach (Byte b in encodedHDSerial) { nr = Algebra.GetIndex(Convert.ToChar(b)); // Bejme kete veprim: ((nr - ((i * 3) + 3) / 7) - 6 nr = Algebra.Substract(Algebra.Divide(Algebra.Substract(nr, Algebra.Sum(Algebra.Multiply(i, 3, 59), 3, 59), 59), 7, 59), 6, 59); hardDiskSerialDec += Algebra.GetChar(nr).ToString(); i++; } int numerDhomash = Convert.ToInt32(nrDhomashDec); numerDhomash = (numerDhomash + 4) * 3; // Tani bashkojme vlerat e gjetura nga deshifrimet e mesiperme dhe e kthejme kete vlere return(systemSerialDec + hardDiskSerialDec + systemTimeDec + "-" + numerDhomash.ToString()); } catch (Exception ex) { return(""); } }