Sujet : Re: xorpng
De : rich (at) *nospam* example.invalid (Rich)
Groupes : sci.cryptDate : 06. Jan 2025, 04:42:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vlfje9$1ande$5@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:
*Please* try to write a .ppm (P6) to .png converter (and back) in C(++)
and see if you can get the *original* data back. The sci.crypt community
and me of course would appreciate your help very much!
Since you have not "shown your work" (apologizes if you show it later,
I'm replying as I encounter articles in date order) we can't help you
diagnose your problem.
For the below, I used the smallest "tux the peguin" png image available
from wikipedia [1].
$ pngtopam Tux.svg.png > Tux.svg.png.ppm
$ ls -ls
4 drwxr-xr-x 2 4096 Jan 5 22:33 ./
1128 drwxrwxrwt 87 1150976 Jan 5 22:30 ../
28 -rw-r--r-- 1 24774 Jan 5 22:32 Tux.svg.png
144 -rw-r--r-- 1 144849 Jan 5 22:33 Tux.svg.png.ppm
Original png downloaded from wikipedia, and a "ppm" created from the
png. (I append extensions just to keep the conversions clear.
Hash of the starting ppm file:
$ sha256sum Tux.svg.png.ppm
130d198065698026f3e258bd43e2c3033190298a6f35298d90a5df2bd566e276 Tux.svg.png.ppm
Convert the ppm to a new png:
$ pamtopng Tux.svg.png.ppm > Tux.svg.png.ppm.png
Convert the newly created png back into another ppm:
$ pngtopam Tux.svg.png.ppm.png > Tux.svg.png.ppm.png.ppm
Hash of the new ppm file:
$ sha256sum Tux.svg.png.ppm.png.ppm
130d198065698026f3e258bd43e2c3033190298a6f35298d90a5df2bd566e276 Tux.svg.png.ppm.png.ppm
Identical hash as the original:
$ sha256sum Tux.svg.png.ppm Tux.svg.png.ppm.png.ppm
130d198065698026f3e258bd43e2c3033190298a6f35298d90a5df2bd566e276 Tux.svg.png.ppm
130d198065698026f3e258bd43e2c3033190298a6f35298d90a5df2bd566e276 Tux.svg.png.ppm.png.ppm
The four files, original png, ppm from png, new png from ppm, and ppm
created from last png:
$ ls -ls Tux.svg.png*
28 -rw-r--r-- 1 24774 Jan 5 22:32 Tux.svg.png
144 -rw-r--r-- 1 144849 Jan 5 22:33 Tux.svg.png.ppm
24 -rw-r--r-- 1 21863 Jan 5 22:33 Tux.svg.png.ppm.png
144 -rw-r--r-- 1 144849 Jan 5 22:34 Tux.svg.png.ppm.png.ppm
So, to the extent I can tell, you are doing something wrong somewhere.
[1] Direct link to image I downloaded:
https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/202px-Tux.svg.pngWikipedia page where the image is linked:
https://en.wikipedia.org/wiki/Electronic_codebook