Sujet : Re: xorpng
De : pollux (at) *nospam* tilde.club (Stefan Claas)
Groupes : sci.cryptDate : 07. Jan 2025, 22:41:22
Autres entêtes
Organisation : To protect and to server
Message-ID : <vlk724$1e44f$1@paganini.bofh.team>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : flnews/1.3.0pre29 (for GNU/Linux)
Stefan Claas wrote:
Rich wrote:
Stefan Claas <pollux@tilde.club> wrote:
Rich wrote:
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.
So, to the extent I can tell, you are doing something wrong somewhere.
Please try your conversion steps with the encrypted image, I already
have shown:
https://jmp.sh/HZM9ML9f
It includes a padding byte, needed for ppm so that it is divideable by 3.
That PPM is over-sized. The image header claims:
P6
# Created by GIMP version 2.10.34 PNM plug-in
480 480
255
For 480x480 pixels, with a maxval of 255 (1 byte per color) and three
color channels, the binary part of the ppm should be:
480*480*3=691,200 bytes long.
Instead, the binary part of the ppm is 691228 bytes long (28 bytes too
many are present).
So when converting it to a PNG, 28 bytes are lost, which do not return
when converting back from PNG to PPM.
Yes, I did something wrong. I stick with my fil2png program, which writes
directly png files from any data. A Python3 version is uploaded as well,
for those who do not use Go or do not want to use my binaries.
Well, now I managed it with a different approach. I use now bin2ppm.go,
which produces from (binary) input a valid P3 ppm file, which I loaded
into Gimp, converted to .png and re-converted back to ppm in Gimp.
I used the follwoing procedure:
$ bc <<< 64*32*3
6144
$ echo "Hello sci.crypt community. This is a little test with bin2ppm.go" | pad -p 6144 > message.txt
$ bin2ppm 64 32 < message.txt > message.ppm
After that I converted to .png and back to .ppm with Gimp and then:
$ bin2ppm -d < message-gimp-png.ppm > decoded-message.txt
https://jmp.sh/LexKevVbhttps://github.com/706f6c6c7578/bin2ppm-- RegardsStefan