I'm a bit baffled when it comes to converting this javascript over to C#...
Any help would be appreciated!
Here is the javascript:
function d(strInput) {
strInput = decoder(strInput);
var strOutput = "";
var intOffset = (key + 112) / 12;
for (i = 4; i < strInput.length; i++) {
thisCharCode = strInput.charCodeAt(i);
newCharCode = thisCharCode - intOffset;
strOutput += String.fromCharCode(newCharCode)
}
document.write(strOutput)
}
And this is my attempt at converting it to C#. It works some of the time, but most of the time for negative numbers as the key...
public string decode(int key, string data)
{
int i;
string strInput = base64Decode(data);
StringBuilder strOutput = new StringBuilder("");
int intOffset = (key + 112) / 12;
for (i = 4; i < strInput.Length; i++)
{
int thisCharCode = strInput[i];
char newCharCode = (char)(thisCharCode - intOffset);
strOutput.Append(newCharCode);
}
return strOutput.ToString();
}
Currently it outputs the following:
(int key = 212, string data = "U0lra36DfImFkImOkImCW4OKj4h8hIdJfoqI")
Output = {c¬a¬¬¬¬¬¬¬¬@¬¬¬¬a¬¬.c¬¬}
(int key = -88, string data = "T1RXYmV0cHFkZ3R1MzQ1Ng==")
Output = {crnobers1234}