From faf37a4a47cdb5a9ede8a4996686387e24c0ff62 Mon Sep 17 00:00:00 2001 From: de4dot Date: Mon, 3 Dec 2012 01:22:14 +0100 Subject: [PATCH] Use a char[] instead of a StringBuilder since length is known --- de4dot.code/deobfuscators/Agile_NET/StringDecrypter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/de4dot.code/deobfuscators/Agile_NET/StringDecrypter.cs b/de4dot.code/deobfuscators/Agile_NET/StringDecrypter.cs index c7b858d6..14685340 100644 --- a/de4dot.code/deobfuscators/Agile_NET/StringDecrypter.cs +++ b/de4dot.code/deobfuscators/Agile_NET/StringDecrypter.cs @@ -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); } } }