Use a char[] instead of a StringBuilder since length is known

This commit is contained in:
de4dot 2012-12-03 01:22:14 +01:00
parent 9a4cd237e5
commit faf37a4a47

View File

@ -76,10 +76,10 @@ namespace de4dot.code.deobfuscators.Agile_NET {
public string decrypt(string es) {
if (stringDecrypterKey == null)
throw new ApplicationException("Trying to decrypt strings when stringDecrypterKey is null (could not find it!)");
StringBuilder sb = new StringBuilder(es.Length);
char[] buf = new char[es.Length];
for (int i = 0; i < es.Length; i++)
sb.Append(Convert.ToChar((int)(es[i] ^ stringDecrypterKey[i % stringDecrypterKey.Length])));
return sb.ToString();
buf[i] = (char)(es[i] ^ stringDecrypterKey[i % stringDecrypterKey.Length]);
return new string(buf);
}
}
}