its not a language.. its just to diplay what i meaned.
Now i wrote this code In VB.NET and it still returns incorrect letters, can you find the mistake?
Code:
Sub Main()
Dim TEAMSPEAK_CONF_PATH As String = "C:\ts.conf"
Dim TsConfContent As String = New StreamReader(TEAMSPEAK_CONF_PATH).ReadToEnd
Dim FinString As String = ""
Dim CharCount As Int64
Dim BytesWhichDontFit As Int32 = TsconfContent.Length Mod 4
For Each c As Char In TsconfContent
Dim b As Byte
If CharCount >= TsConfContent.Length - BytesWhichDontFit Then
b = Asc(c) Xor &HAD
FinString &= Chr(b)
Else
b = Asc(c) Xor GetByteFromArray(CharCount)
FinString &= Chr(b)
End If
CharCount += 1
Next
Dim str As New StreamWriter("C:\ts_dec.lol")
str.Write(FinString)
str.Close()
Console.ReadLine()
End Sub
Private Function GetByteFromArray(ByVal Count As Int64) As Byte
Dim b() As Byte = {&HAD, &HA6, &H6D, &HAD}
Dim i As Integer
While Count > 3
Count -= 4
i += 1
End While
Return b(Count)
End Function
Or if you hate vb.net, here its converted into C#:
Code:
public void Main()
{
string TEAMSPEAK_CONF_PATH = "C:\\ts.conf";
string TsConfContent = new StreamReader(TEAMSPEAK_CONF_PATH).ReadToEnd;
string FinString = "";
Int64 CharCount = default(Int64);
Int32 BytesWhichDontFit = TsconfContent.Length % 4;
foreach (char c in TsconfContent) {
byte b = 0;
if (CharCount >= TsConfContent.Length - BytesWhichDontFit) {
b = Strings.Asc(c) ^ 0xad;
FinString += Strings.Chr(b);
}
else {
b = Strings.Asc(c) ^ GetByteFromArray(CharCount);
FinString += Strings.Chr(b);
}
CharCount += 1;
}
StreamWriter str = new StreamWriter("C:\\ts_dec.lol");
str.Write(FinString);
str.Close();
Console.ReadLine();
}
private byte GetByteFromArray(Int64 Count)
{
byte[] b = { 0xad, 0xa6, 0x6d, 0xad };
int i = 0;
while (Count > 3) {
Count -= 4;
i += 1;
}
return b(Count);
}