Replace hexstrings with ASCII85
Probably old news, but I just learned it. :)
You can do it using the postscript interpreter interactively with an encoding filter and cut-and-paste. But I'm going to show how to use dc
to do it "by hand".
So, here's a hex string. We split it into 4-byte chunks.
95 20 6e d8 d0 59 49 35 50 74 ba c5 08 2d
Firing up dc, we input these as 32-bit (unsigned) big-endian-byte-order numbers. Then mod-off base-85 digits (there should be 5 until you get to 0).
0> dc
16i
95206ED8
Ai
d85%n85/
82
d85%n85/
83
d85%n85/
82
d85%n85/
78
d85%n85/
47
d85%n85/
0
Padding the last chunk with 00 00
, yields (decimal), omitting the same number of bytes that we padded.
47 78 82 83 82 66 81 72 79 83 25 72 82 25 69 2 53 30 [2 53]
Add 33 to shift into the printable range of ASCII and poof! ASCII85.
80 111 115 116 115 99 114 105 112 116 58 105 115 58 102 35 86 63
which decodes to:
Postscript:is:f#V?
%%%Oops! should say 'fun'! I screwed up somewhere. :)
Wrap it in <~
... ~>
, and Level-2 Postscript can access 8-bit data, cheaper than hex.
Found some external pages: https://sites.google.com/site/codegolfingtips/Postscript
– luser droog – 2012-11-20T06:14:50.860