[Pas2js] pas2js pju format

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Aug 2 17:01:42 CEST 2018


On Thu, 2 Aug 2018 15:05:53 +0200 (CEST)
Michael Van Canneyt <michael at freepascal.org> wrote:

> On Thu, 2 Aug 2018, warleyalex via Pas2js wrote:
> 
> > The modified compiler "Pas2JS" used at by TMS Web Core, has a feature that
> > understands the proprietary .pju format. It seems they encrypted the .pas to
> > .pju format.
> >
> > .pas --> .dcu (win32)
> > .pas -->. pju (web)
> >
> > The published pas2js compiler could have such feature, to protect the source
> > code.
> >
> > Any suggestion how to decompile/open these .pju files? :)  
> 
> They paid Mattias to develop this feature to be able to distribute demos.
> It would not be correct to disclose this information.
> 
> But AFAIK Mattias implemented this in such a way that another format can be
> added to the compiler.

Correct.

Remarks:
A dcu/ppu file has basically two features: It works as a cache to speed
up further compilation and allows closed source distributions. But it is
tight to the exact version of compiler and Pascal files.
A pju file is not bound to the exact version, so a pju file can still
be used when a new bugfix releases is released.

About protect the source code:
Since pas2js does not yet optimize much, the produced JavaScript is
easier to disassemble than dcu/ppu.

pas2js has a framework for readers/writers. The basic format "pcu" is
complete enough for the test suite. The pju format is closed source and
extends the pcu format by checking for signatures. The pcu format is
more like ppu files - it is bound to the exact compiler version and RTL.

What is missing to get pcu files:
- Store and check checksums
- when loading a pcu file, it loads recursively other pcu files. If one
  of them is faulty, unload the affected pcu files and compile
  sources if available.
- pcudump tool

Mattias


More information about the Pas2js mailing list