public static byte[] DecryptCompressedInt32Data(Arg64ConstantsReader constReader, int exprStart, int exprEnd, ref DataReader reader, byte[] decrypted) { for (int i = 0; i < decrypted.Length; i++) { constReader.Arg = reader.Read7BitEncodedInt32(); int index = exprStart; if (!constReader.GetInt64(ref index, out long result) || index != exprEnd) { throw new ApplicationException("Could not decrypt integer"); } decrypted[i] = (byte)result; } return(decrypted); }
byte[] DecryptConstant_v15_r60785_dynamic(DecrypterInfo info, byte[] encrypted, uint offs) { var instrs = info.decryptMethod.Body.Instructions; int startIndex = GetDynamicStartIndex_v15_r60785(instrs); int endIndex = GetDynamicEndIndex_v15_r60785(instrs, startIndex); if (endIndex < 0) { throw new ApplicationException("Could not find start/endIndex"); } var dataReader = ByteArrayDataReaderFactory.CreateReader(encrypted); var decrypted = new byte[dataReader.ReadInt32()]; var constReader = new Arg64ConstantsReader(instrs, false); ConfuserUtils.DecryptCompressedInt32Data(constReader, startIndex, endIndex, ref dataReader, decrypted); return(decrypted); }
public override string Decrypt(MethodDef caller, int magic) { var reader = stringDecrypter.reader; reader.Position = (caller.MDToken.ToInt32() ^ magic) - stringDecrypter.magic1; int len = reader.ReadInt32() ^ (int)~stringDecrypter.magic2; var decrypted = new byte[len]; int startIndex, endIndex; if (!FindPolyStartEndIndexes(out startIndex, out endIndex)) { throw new ApplicationException("Could not get start/end indexes"); } var constReader = new Arg64ConstantsReader(stringDecrypter.decryptMethod.Body.Instructions, false); ConfuserUtils.DecryptCompressedInt32Data(constReader, startIndex, endIndex, reader, decrypted); return(Encoding.Unicode.GetString(decrypted)); }
public override string Decrypt(MethodDef caller, int magic) { var reader = stringDecrypter.reader; reader.Position = (caller.MDToken.ToInt32() ^ magic) - stringDecrypter.magic1; int len = reader.ReadInt32() ^ (int)~stringDecrypter.magic2; var decrypted = new byte[len]; int startIndex, endIndex; if (!FindPolyStartEndIndexes(out startIndex, out endIndex)) throw new ApplicationException("Could not get start/end indexes"); var constReader = new Arg64ConstantsReader(stringDecrypter.decryptMethod.Body.Instructions, false); ConfuserUtils.DecryptCompressedInt32Data(constReader, startIndex, endIndex, reader, decrypted); return Encoding.Unicode.GetString(decrypted); }
byte[] DecryptConstant_v15_r60785_dynamic(DecrypterInfo info, byte[] encrypted, uint offs) { var instrs = info.decryptMethod.Body.Instructions; int startIndex = GetDynamicStartIndex_v15_r60785(instrs); int endIndex = GetDynamicEndIndex_v15_r60785(instrs, startIndex); if (endIndex < 0) throw new ApplicationException("Could not find start/endIndex"); var dataReader = MemoryImageStream.Create(encrypted); var decrypted = new byte[dataReader.ReadInt32()]; var constReader = new Arg64ConstantsReader(instrs, false); ConfuserUtils.DecryptCompressedInt32Data(constReader, startIndex, endIndex, dataReader, decrypted); return decrypted; }
public static byte[] DecryptCompressedInt32Data(Arg64ConstantsReader constReader, int exprStart, int exprEnd, IBinaryReader reader, byte[] decrypted) { for (int i = 0; i < decrypted.Length; i++) { constReader.Arg = reader.Read7BitEncodedInt32(); int index = exprStart; long result; if (!constReader.GetInt64(ref index, out result) || index != exprEnd) throw new ApplicationException("Could not decrypt integer"); decrypted[i] = (byte)result; } return decrypted; }