1

This question is inspired by this one: Convert PDF to PDF of images?

As the author does have the code, creating a LaTeX version that is difficult to decrypt seems to be a good solution. Certainly, it is easy to block the compilation as in The TeXbook:

\loop\iftrue
  \errmessage{This manual is copyrighted and should not be TeXed}\repeat
\pausing1 \input manmac
\ifproofmode\message{Proof mode is on!}\pausing1\fi

but it is easy to omit. One can, using \immediate\write and \immediate\read require a password to compile, but it is also visible in the code.

However, in this thread, How can we draw a Christmas tree with decorations, using TikZ? David Carlisle gave a beautiful example of a pseudo-encrypted code.

How can we create such a code?

  • 1
    The engines support getting md5 hashes from files, you could use that for your password approach without storing your password in the file. But still, if I have access to the code I can circumvent whatever you use (and yes, even if you obfuscate your code as David often does, then it just takes a bit longer). – Skillmon Dec 29 '21 at 17:25
  • @Skillmon Certainly, my idea is useless against advanced TeX users. But the initial question was also a request to make harder the extraction of a text. – Przemysław Scherwentke Dec 29 '21 at 17:31
  • 1
    ... I'd definitely not encourage doing this. – Obviously, by doing the same way how normal DRM works in machine code/assembly – embed it into the source code, and make the whole thing so large that nobody have the effort to step through the code. – user202729 Dec 30 '21 at 09:06
  • Actually, just implement AES-256 encryption in TeX, then dynamically decrypt the file with the provided password... at this stage just compress it with 7-zip. – user202729 Dec 30 '21 at 09:19
  • 2
    You could as well (after implementing AES-256 in TeX) dump that into a format and only distribute the encrypted TeX file along the cryptopdflatex format and the password hash (which could be placed at the start of your encrypted file). Be aware that this way LaTeX will probably need a bit of time to run, and you wouldn't want to create any (unencrypted) temporary files as that would be an obvious security risk! I begin to really like this idea :) – Skillmon Dec 30 '21 at 10:51

0 Answers0