Re: xorpng

Liste des GroupesRevenir à s crypt 
Sujet : Re: xorpng
De : rich (at) *nospam* example.invalid (Rich)
Groupes : sci.crypt
Date : 05. Jan 2025, 17:30:58
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vlec42$13phn$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Stefan Claas <pollux@tilde.club> wrote:
Rich wrote:
Stefan Claas <pollux@tilde.club> wrote:
Rich wrote:
 
If instead you mean some kind of "special, PNG aware, encryptor that
only encrypted the bitmap data of a PNG", but left the file as
otherwise a proper PNG image structure, then that is slightly tricky
(and an algorithm that is only useful for PNG's alone).
 
Yes, this is what I mean.
 
Which brings up the question of: why?
 
Why go to the trouble to create an encryptor that is specalized for
just encrypting the internal bitmap data within a PNG, leaving the rest
as a PNG file, when a generic "byte stream" encryptor will encrypt the
entire PNG with no extra effort?
 
To make more content as allowed postable on social media, like X.

Ah, because the intermediate pipe is not transparent, and essentially
does the equivalent of 'file post.png' and disallows posting of
"post.png" files that do not return as "post.png: PNG image data, ...".

In which case, you would 'simplify' your 'image encryptor' if it
instead encrypted NetPBM [1] images, and relied upon the NetPBM tools
to convert the result to a PNG (or a GIF, or a 'whatever').  A NetPBM
image is a very short ASCII text header, followed by the raw binary
bitmap data (there is even an older ASCII bitmap data format for NetPBM
if you wanted to use that).

Then, you need:
1) a generic binary encryptor/decryptor
2) a very small utility to wrap/unwrap a NetPBM header onto the binary
   data (you would take care of padding to/from a "rectangle" the
   binary data here)
3) the NetPBM tools to convert to/from other image formats for actual
   posting

I.e., here's a very small (10x10) PNG (created with GIMP, I used
exiftool to remove the 'created with GIMP' comment):

  $ ls -l sc.png
  -rw-r--r-- 1              110 Jan  5 11:20 sc.png

Here's the xxd encoded version:

  $ xxd sc.png
  00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
  00000010: 0000 000a 0000 000a 0802 0000 0002 5058  ..............PX
  00000020: ea00 0000 0970 4859 7300 002e 2300 002e  .....pHYs...#...
  00000030: 2301 78a5 3f76 0000 0007 7449 4d45 07e9  #.x.?v....tIME..
  00000040: 0105 1013 3242 3f8a 0a00 0000 0d49 4441  ....2B?......IDA
  00000050: 5418 d363 6018 05a4 0300 0136 0001 1ad5  T..c`......6....
  00000060: 8d17 0000 0000 4945 4e44 ae42 6082       ......IEND.B`.

Convert it to pnm:

  $ pngtopam sc.png > sc.ppm

Here is what 'file' reports:

  $ file sc.ppm
  sc.ppm: Netpbm image data, size = 10 x 10, rawbits, pixmap

And the file is this ASCII header:

P6
10 10
255

followed by 298 ASCII null bytes:

  $ xxd sc.ppm
  00000000: 5036 0a31 3020 3130 0a32 3535 0a00 0000  P6.10 10.255....
  00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000130: 0000 0000 0000 0000 00                   .........

It is trivial to "replace" the binary part of the ppm file above with
an encrypted version thereof.  Then the 'pamtopng' tool from NetPBM can
be used to convert the 'replaced' image back into a PNG (or GIF or TIFF
or one of numerous other formats, using other pamto or pnmto
converters).

[1] https://netpbm.sourceforge.net/

Note, I've used the Unix CLI tools above for ease of demonstration
purposes.  NetPBM is also a library, so you very well may have a go
module for NetPBM available, where you can perform these transforms
from within go by calling the netpbm library rather than needing the
CLI toolset installed.

Date Sujet#  Auteur
1 Jan 25 * Ternary Encoding :-)99Stefan Claas
1 Jan 25 +* Re: Ternary Encoding :-)25Stefan Claas
1 Jan 25 i`* Re: Ternary Encoding :-)24Rich
1 Jan 25 i +* Re: Ternary Encoding :-)6Stefan Claas
1 Jan 25 i i+* Re: Ternary Encoding :-)4Stefan Claas
1 Jan 25 i ii+- Re: Ternary Encoding :-)1Stefan Claas
1 Jan 25 i ii`* Re: Ternary Encoding :-)2Rich
11 Jan 25 i ii `- Re: Ternary Encoding :-)1Chris M. Thomasson
1 Jan 25 i i`- Re: Ternary Encoding :-)1Rich
1 Jan 25 i `* Re: Ternary Encoding :-)17Stefan Claas
1 Jan 25 i  `* Re: Ternary Encoding :-)16Rich
2 Jan 25 i   `* Re: Ternary Encoding :-)15Stefan Claas
2 Jan 25 i    `* Re: Ternary Encoding :-)14Rich
2 Jan 25 i     `* Re: Ternary Encoding :-)13Stefan Claas
2 Jan 25 i      +* Re: Ternary Encoding :-)4Stefan Claas
2 Jan 25 i      i`* Re: Ternary Encoding :-)3Rich
3 Jan 25 i      i `* Re: Ternary Encoding :-)2Stefan Claas
3 Jan 25 i      i  `- Re: Ternary Encoding :-)1Rich
2 Jan 25 i      `* Re: Ternary Encoding :-)8Rich
3 Jan 25 i       `* Re: Ternary Encoding :-)7Stefan Claas
3 Jan 25 i        `* Re: Ternary Encoding :-)6Stefan Claas
3 Jan 25 i         +- Re: Ternary Encoding :-)1Rich
3 Jan 25 i         `* Re: Ternary Encoding :-)4Rich
3 Jan 25 i          +- Re: Ternary Encoding :-)1Stefan Claas
8 Jan 25 i          `* Re: Ternary Encoding :-)2Chax Plore
8 Jan 25 i           `- Re: Ternary Encoding :-)1Rich
3 Jan 25 `* Re: Ternary Encoding :-)73Chris M. Thomasson
3 Jan 25  `* Re: Ternary Encoding :-)72Stefan Claas
3 Jan 25   `* Re: Ternary Encoding :-)71Chris M. Thomasson
4 Jan 25    `* xorpng (was: Ternary Encoding :-))70Stefan Claas
4 Jan 25     +- Re: xorpng1Stefan Claas
4 Jan 25     `* Re: xorpng68Chris M. Thomasson
4 Jan 25      `* Re: xorpng67Stefan Claas
4 Jan 25       `* Re: xorpng66Chris M. Thomasson
4 Jan 25        `* Re: xorpng65Chris M. Thomasson
4 Jan 25         `* Re: xorpng64Stefan Claas
4 Jan 25          `* Re: xorpng63Chris M. Thomasson
4 Jan 25           `* Re: xorpng62Stefan Claas
4 Jan 25            +* Re: xorpng53Chris M. Thomasson
5 Jan 25            i`* Re: xorpng52Stefan Claas
5 Jan 25            i `* Re: xorpng51Rich
5 Jan 25            i  `* Re: xorpng50Stefan Claas
5 Jan 25            i   +* Re: xorpng8Chris M. Thomasson
5 Jan 25            i   i`* Re: xorpng7Stefan Claas
5 Jan 25            i   i `* Re: xorpng6Chris M. Thomasson
5 Jan 25            i   i  +- Re: xorpng1Chris M. Thomasson
5 Jan 25            i   i  `* Re: xorpng4Stefan Claas
5 Jan 25            i   i   `* Re: xorpng3Chris M. Thomasson
5 Jan 25            i   i    `* Re: xorpng2Stefan Claas
5 Jan 25            i   i     `- Re: xorpng1Chris M. Thomasson
5 Jan 25            i   `* Re: xorpng41Rich
5 Jan 25            i    +* Re: xorpng36Stefan Claas
5 Jan 25            i    i+* Re: xorpng27Stefan Claas
5 Jan 25            i    ii`* Re: xorpng26Rich
5 Jan 25            i    ii `* Re: xorpng25Stefan Claas
5 Jan 25            i    ii  `* Re: xorpng24Rich
5 Jan 25            i    ii   `* Re: xorpng23Stefan Claas
6 Jan 25            i    ii    +* Re: xorpng21Stefan Claas
6 Jan 25            i    ii    i+* Re: xorpng2Chris M. Thomasson
6 Jan 25            i    ii    ii`- Re: xorpng1Chris M. Thomasson
6 Jan 25            i    ii    i+- Re: xorpng1Chris M. Thomasson
6 Jan 25            i    ii    i`* Re: xorpng17Rich
6 Jan 25            i    ii    i `* Re: xorpng16Stefan Claas
6 Jan 25            i    ii    i  +* Re: xorpng5Stefan Claas
6 Jan 25            i    ii    i  i+* Re: xorpng3Stefan Claas
7 Jan 25            i    ii    i  ii`* Re: xorpng2Jan Panteltje
7 Jan 25            i    ii    i  ii `- Re: xorpng1Stefan Claas
7 Jan 25            i    ii    i  i`- Re: xorpng1Rich
6 Jan 25            i    ii    i  `* Re: xorpng10Rich
7 Jan 25            i    ii    i   `* Re: xorpng9Stefan Claas
7 Jan 25            i    ii    i    `* Re: xorpng8Stefan Claas
11 Jan 25            i    ii    i     `* Re: xorpng7Stefan Claas
11 Jan 25            i    ii    i      `* Re: xorpng6Stefan Claas
11 Jan 25            i    ii    i       `* Re: xorpng5Chris M. Thomasson
11 Jan 25            i    ii    i        +- Re: xorpng1Chris M. Thomasson
11 Jan 25            i    ii    i        `* Re: xorpng3Stefan Claas
12 Jan 25            i    ii    i         `* Re: xorpng2Chris M. Thomasson
5 Mar 25            i    ii    i          `- Re: xorpng1Stefan Claas
6 Jan 25            i    ii    `- Re: xorpng1Rich
5 Jan 25            i    i+- Re: xorpng1Rich
5 Jan 25            i    i`* Re: xorpng7Chris M. Thomasson
5 Jan 25            i    i +* Re: xorpng5Chris M. Thomasson
5 Jan 25            i    i i`* Re: xorpng4Stefan Claas
5 Jan 25            i    i i +* Re: xorpng2Chris M. Thomasson
6 Jan 25            i    i i i`- Re: xorpng1Rich
5 Jan 25            i    i i `- Re: xorpng1Chris M. Thomasson
6 Jan 25            i    i `- Re: xorpng1Rich
10 Feb 25            i    `* Re: xorpng4Richard Heathfield
10 Feb 25            i     +* Re: xorpng2Rich
10 Feb 25            i     i`- Re: xorpng1Richard Heathfield
10 Feb 25            i     `- Re: xorpng1Jan Panteltje
4 Jan 25            `* Re: xorpng8Chris M. Thomasson
4 Jan 25             +* Re: xorpng2Chris M. Thomasson
5 Jan 25             i`- Re: xorpng1Stefan Claas
5 Jan 25             `* Re: xorpng5Stefan Claas
5 Jan 25              `* Re: xorpng4Stefan Claas
5 Jan 25               `* Re: xorpng3Chris M. Thomasson
5 Jan 25                `* Re: xorpng2Stefan Claas
5 Jan 25                 `- Re: xorpng1Chris M. Thomasson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal