3 ms·
Not that hacky or mind-boggling, but does involve a hex editor and lots of money... I added support for the '\ ' PostScript escaped space sequence to a custom,
by sshine 4y ago
Not that hacky or mind-boggling, but does involve a hex editor and lots of money...
I added support for the '\ ' PostScript escaped space sequence to a custom, high-performance PDF parser.
A former employer used this to derive key figures from financial statements. Any change to the parser had to be Pareto-optimal: so if you modified the parser, it should not fail to parse any key figure that was previously possible to parse. Adding this improved reading word-wrapped text in hundreds of cases and key figures in dozens; I recall that my bosses thought it must be a mistake, and that I had to convince them by finding the right section in some Adobe PDF spec.
I wasn't an expert at the PDF format. But stumbling on a number split in two by apparently nothing, and digging up a 0x5C 0x20 '\ ' with a hex editor, I seemed to recall that PDF was built on top of PostScript, and that TeX / LaTeX syntax was somehow related to PostScript. So it struck me that what was a literal backslash in the PDF must just be an escape sequence.
- actionfromafar 4y ago"to build a custom, high-performance PDF parser" ?
- ASalazarMX 4y ago> but does involve a hex editor Oh, your comment reminded me of one of my proudest moments as a high school student! Norton Utilities was a must for any MS-DOS user, and so, poor students pirated it when they could. The problem was once installed, it asked for a password, and subsequent runs would demand it. My friend got ahold of a diskette with a complete but password-locked copy, and while he knew the password, he found it annoying and wanted to bypass it. By trial and error, we found a location where the binary stored the password, but it was encrypted. Studying the "encryption", it turned out it was an XOR of the password padded with spaces until I think 20 characters, so you could change that location to XORed spaces to enter the password with a single Enter, or change it to zeros so it behaved like a new install. I don't know what my friend did with his copy, I just remember the high of beating the copy protection of the legendary Peter Norton.