title: C# decrypting unknown encryption method
body: <p>I want ask about decrypting method for my file
  i already had C# program that give me some clue about decryption this file</p>
  
  <p>here is some code for decryption:</p>
  
  <pre><code>string strFilePath = @"F:\Backup Data HDD\Data HDD (E)\project\dat\target_file.bin";
              sbyte num;
              int num3;
              sbyte num5;
              FileStream stream = File.OpenRead(strFilePath);
              byte[] buffer = new byte[stream.Length];
              stream.Read(buffer, 0, (int)stream.Length);
              stream.Close();
              int num2 = 72957;// 0x11cfd;
              int num4 = 0;
              for (num3 = 0; num3 != buffer.Length; num3++)
              {
                  num = (sbyte)buffer[num3];
                  num5 = num;
                  num = (sbyte)(num ^ (num2 &gt;&gt; 8));
                  num2 = ((num5 + num2) * 52845/*0xce6d*/) + 22719;//0x58bf;
                  buffer[num3] = (byte)num;
              }
              MemoryStream input = new MemoryStream(buffer);
              BinaryReader reader = new BinaryReader(input);
              switch (this.m_Util.ByteArrayToString(reader.ReadBytes(64)))//0x40
              {
                  case "ItemFile v5":
                      num4 = 5;
                      break;
  
                  case "ItemFile v6":
                      num4 = 6;
                      break;
  
                  case "ItemFile v7":
                      num4 = 7;
                      break;
  
                  case "ItemFile v10":
                  case "ItemFile v11":
                      num4 = 10;
                      break;
              }
  </code></pre>
  
  <p>I just confuse how to read the string under this file
  because the switch case is working when i try to print it:</p>
  
  <pre><code>Console.Write(num4.toString());
  </code></pre>
  
  <p>it give me a number <code>10</code>
  so the file is readable by this code and the code can read "Item File v10" or "Item File v11" because it return <code>10</code> when printed to console</p>
  
  <p>but when i try to print this</p>
  
  <pre><code>Console.Write(this.m_Util.ByteArrayToString(reader.ReadBytes(64)));
  </code></pre>
  
  <p>it give me <code>È2</code> (ascii)
  I'm beginner on C#
  Can you help me ?
  Thank you</p>