• xorpng (was: Ternary Encoding :-))

    From Stefan Claas@21:1/5 to Chris M. Thomasson on Sat Jan 4 19:06:29 2025
    Chris M. Thomasson wrote:
    On 1/3/2025 7:13 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 12/31/2024 5:00 PM, Stefan Claas wrote:
    echo 'Happy News Year 2025' | ternary 2112102022020111101010222211010022112012102120110020100021120220 10000111010121200020221000211000220022020

    $ echo 'Happy News Year 2025' | ternary | ternary -d
    Happy News Year 2025

    (My program works with binary data as well.)


    Side note, try to get 3-ary roots from the following... It's not that hard but its fun wrt the results one can reap from it:

    https://paulbourke.org/fractals/multijulia

    Nice, but I do no longer do Computer Graphics.


    In a sense, its all about discovering the n-ary roots of a complex
    number... For fun, I mapped actual data to said roots... :^)

    I think I called them nits. trits would be 3-ary, akin to ternary.

    Since you do a lot graphics programming, have you ever thought
    about encrypting images with XOR? I just did a small test with
    my xorpng program and wrote a message for you with my little
    WACOM tablet and Microsoft Paint. :-)

    I think this is a really cool (but then with a mouse instead
    of a tablet) when traveling and exchanging keys in advance with
    family and friends and using a Bitmessage's alt.anonymous.messages
    chan and my p4bm program, in case Computers are compromised at the
    destination, when not carrying one and you need no credentials and
    only the keys on a Kanguru Defender 3000.

    Here are the test images:

    https://jmp.sh/jp1A5kvq

    and here is my xorpng and p4bm program:

    https://github.com/706f6c6c7578/xorpng
    https://github.com/706f6c6c7578/p4bm

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Sat Jan 4 19:53:57 2025
    Stefan Claas wrote:

    I think this is a really cool (but then with a mouse instead
    of a tablet) when traveling and exchanging keys in advance with
    family and friends and using a Bitmessage's alt.anonymous.messages
    chan and my p4bm program, in case Computers are compromised at the destination, when not carrying one and you need no credentials and
    only the keys on a Kanguru Defender 3000.

    https://github.com/706f6c6c7578/xorpng
    https://github.com/706f6c6c7578/p4bm


    Message to large for Bitmessage and as an attachment for Remailers
    woil not work, I guess, either. So Onion Courier direct messaging,
    with a temporary Onion Courier Server, is the solution ... :-)

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sat Jan 4 22:08:40 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 10:06 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/3/2025 7:13 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 12/31/2024 5:00 PM, Stefan Claas wrote:
    echo 'Happy News Year 2025' | ternary 2112102022020111101010222211010022112012102120110020100021120220 10000111010121200020221000211000220022020

    $ echo 'Happy News Year 2025' | ternary | ternary -d
    Happy News Year 2025

    (My program works with binary data as well.)


    Side note, try to get 3-ary roots from the following... It's not that hard but its fun wrt the results one can reap from it:

    https://paulbourke.org/fractals/multijulia

    Nice, but I do no longer do Computer Graphics.


    In a sense, its all about discovering the n-ary roots of a complex number... For fun, I mapped actual data to said roots... :^)

    I think I called them nits. trits would be 3-ary, akin to ternary.

    Since you do a lot graphics programming, have you ever thought
    about encrypting images with XOR?

    Indeed.


    I just did a small test with
    my xorpng program and wrote a message for you with my little
    WACOM tablet and Microsoft Paint. :-)

    I think this is a really cool (but then with a mouse instead
    of a tablet) when traveling and exchanging keys in advance with
    family and friends and using a Bitmessage's alt.anonymous.messages
    chan and my p4bm program, in case Computers are compromised at the destination, when not carrying one and you need no credentials and
    only the keys on a Kanguru Defender 3000.

    Here are the test images:

    https://jmp.sh/jp1A5kvq

    and here is my xorpng and p4bm program:

    https://github.com/706f6c6c7578/xorpng
    https://github.com/706f6c6c7578/p4bm


    I am sure you are familiar with tux:

    https://words.filippo.io/the-ecb-penguin/

    We can encrypt that image in many different ways, indeed.

    So, do you have an image encryption solution too?

    Here is an analysis of my k-1.png and encrypted.png.
    (one must make sure that the keys are safely stored)

    https://jmp.sh/9fvXJvmo

    $ python3 image_analysis.py
    fourier_peaks: 194566.0
    wavelet_energy: {'LL': 16776624377.0, 'LH': 1891692481.0000002, 'HL': 621089515.0000001, 'HH': 619257027.0000001}
    histogram_variance: {'red': 791946.0, 'green': 792130.44, 'blue': 792015.6} lsb_ratio: 0.9868576388888889
    noise_level: 45.981313657407405
    region_hash_similarity: 1.0
    total_pixels: 230400
    different_pixels: 227953
    difference_percentage: 98.93793402777777

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sat Jan 4 22:32:24 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 1:13 PM, Chris M. Thomasson wrote:
    On 1/4/2025 1:08 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/4/2025 10:06 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/3/2025 7:13 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 12/31/2024 5:00 PM, Stefan Claas wrote:
    echo 'Happy News Year 2025' | ternary 2112102022020111101010222211010022112012102120110020100021120220
    10000111010121200020221000211000220022020

    $ echo 'Happy News Year 2025' | ternary | ternary -d
    Happy News Year 2025

    (My program works with binary data as well.)


    Side note, try to get 3-ary roots from the following... It's not
    that
    hard but its fun wrt the results one can reap from it:

    https://paulbourke.org/fractals/multijulia

    Nice, but I do no longer do Computer Graphics.


    In a sense, its all about discovering the n-ary roots of a complex number... For fun, I mapped actual data to said roots... :^)

    I think I called them nits. trits would be 3-ary, akin to ternary.

    Since you do a lot graphics programming, have you ever thought
    about encrypting images with XOR?

    Indeed.


    I just did a small test with
    my xorpng program and wrote a message for you with my little
    WACOM tablet and Microsoft Paint. :-)

    I think this is a really cool (but then with a mouse instead
    of a tablet) when traveling and exchanging keys in advance with family and friends and using a Bitmessage's alt.anonymous.messages chan and my p4bm program, in case Computers are compromised at the destination, when not carrying one and you need no credentials and only the keys on a Kanguru Defender 3000.

    Here are the test images:

    https://jmp.sh/jp1A5kvq

    and here is my xorpng and p4bm program:

    https://github.com/706f6c6c7578/xorpng https://github.com/706f6c6c7578/p4bm


    I am sure you are familiar with tux:

    https://words.filippo.io/the-ecb-penguin/

    We can encrypt that image in many different ways, indeed.

    So, do you have an image encryption solution too?

    Here is an analysis of my k-1.png and encrypted.png.
    (one must make sure that the keys are safely stored)

    https://jmp.sh/9fvXJvmo

    $ python3 image_analysis.py
    fourier_peaks: 194566.0
    wavelet_energy: {'LL': 16776624377.0, 'LH': 1891692481.0000002, 'HL': 621089515.0000001, 'HH': 619257027.0000001}
    histogram_variance: {'red': 791946.0, 'green': 792130.44, 'blue': 792015.6}
    lsb_ratio: 0.9868576388888889
    noise_level: 45.981313657407405
    region_hash_similarity: 1.0
    total_pixels: 230400
    different_pixels: 227953
    difference_percentage: 98.93793402777777


    Well, an older one was to trying to hide the points that do not escape
    in any escape time fractal. You can take any image, any file for that matter and encrypt it. Then view the file, say with one channel of
    color, say, red. Each byte is mapped to a color, 0...255 Then we can see
    it in this single color. Sometimes ciphers give off some rather
    interesting visual hints! :^)

    This is using fractal images to try to encrypt plaintext:

    http://funwithfractals.atspace.cc/ffe

    Nice, but it does not decrypt the image, right, which should
    be the task.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sat Jan 4 23:10:11 2025
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around
    with storing data in the n-ary roots of complex numbers? they can
    actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ

    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals
    etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that.

    The only interests with graphics is, when it comes to encryption/decryption images.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 01:02:34 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 2:10 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around with storing data in the n-ary roots of complex numbers? they can actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ

    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that.

    The only interests with graphics is, when it comes to encryption/decryption images.


    Fwiw, do you like stereograms? I created some with some of my depth maps created in GLSL shaders. Can you see this one:

    https://i.ibb.co/gwHwpFL/image.png

    Yes, I can see it.

    I have an idea about them. What about combining an anaglyph with a
    stereogram such that the observer would need to do the "eye trick" while wearing the red and blue glasses?

    I created in 1995, with Photoshop 2.5.1/3.0 a stereo image, which needs red/blue glasses. :-) I uploaded it to rarible.com as NFT for 50 ETH,
    but it is no longer there, nor on my harddrive. :-( It looked really
    really cool and was called ORIGAMI.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 00:56:16 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 2:10 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around with storing data in the n-ary roots of complex numbers? they can actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ

    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that.

    The only interests with graphics is, when it comes to encryption/decryption images.


    Keep in mind that you can turn any "bag of bytes" into an image.

    Well, yes ... (see my file2png program) but it is IMHO tricky to do
    image encryption/decryption of .png images, or not?

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 01:10:15 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 2:41 PM, Chris M. Thomasson wrote:
    On 1/4/2025 2:10 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around with storing data in the n-ary roots of complex numbers? they can actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ

    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that.

    The only interests with graphics is, when it comes to encryption/ decryption
    images.


    Fwiw, do you like stereograms? I created some with some of my depth maps created in GLSL shaders. Can you see this one:

    https://i.ibb.co/gwHwpFL/image.png

    Here is my depth map:

    https://www.facebook.com/photo/?fbid=1306311583861170&set=pcb.1306311693861159

    Nice, I used depth-maps to create normal maps and used those to create 3D prints
    of bas-reliefs, in the past. They turned out pretty good and this was not much explored by the 3D Graphics community, because it requires special knowledge, which is probably not widely available, to get the correct results, without unwanted artifacts and a proper bas-relief look.

    <https://www.behance.net/gallery/62753223/Bas-reliefs-from-3D-models>

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Sun Jan 5 01:19:05 2025
    Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/4/2025 2:10 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around with storing data in the n-ary roots of complex numbers? they can actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ

    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that.

    The only interests with graphics is, when it comes to encryption/decryption
    images.


    Fwiw, do you like stereograms? I created some with some of my depth maps created in GLSL shaders. Can you see this one:

    https://i.ibb.co/gwHwpFL/image.png

    Yes, I can see it.

    I have an idea about them. What about combining an anaglyph with a stereogram such that the observer would need to do the "eye trick" while wearing the red and blue glasses?

    I created in 1995, with Photoshop 2.5.1/3.0 a stereo image, which needs red/blue glasses. :-) I uploaded it to rarible.com as NFT for 50 ETH,
    but it is no longer there, nor on my harddrive. :-( It looked really
    really cool and was called ORIGAMI.

    Well,I found it on rarible.com, sorry my mistake.

    <https://rarible.com/token/0xc9154424b823b10579895ccbe442d41b9abd96ed:33722708843760813648285509687083650090679594480478541226033658120821450735646>

    use the maginfying glass to see the original size and use red/blues glasses
    to see the effect. :-)

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Rich on Sun Jan 5 01:21:43 2025
    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.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Sun Jan 5 00:15:46 2025
    Stefan Claas <pollux@tilde.club> wrote:
    Chris M. Thomasson wrote:
    On 1/4/2025 2:10 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around
    with storing data in the n-ary roots of complex numbers? they can
    actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ >> > >
    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals >> > etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that. >> >
    The only interests with graphics is, when it comes to encryption/decryption
    images.


    Keep in mind that you can turn any "bag of bytes" into an image.

    Well, yes ... (see my file2png program) but it is IMHO tricky to do
    image encryption/decryption of .png images, or not?

    If the encryption/decryption program treats its input as just a byte
    stream to be encrypted/decrypted, then it is trivial to encrypt/decrypt
    any file format.

    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).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Sun Jan 5 06:17:47 2025
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 10:24:02 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 4:21 PM, Stefan Claas 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.


    Well, take a good ol' bag o' bytes and turn it into a valid png?

    No, encrypt a .png, so that an encrypted noise image comes out.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Rich on Sun Jan 5 10:25:45 2025
    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.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 10:27:08 2025
    Chris M. Thomasson wrote:
    On 1/4/2025 4:19 PM, Stefan Claas wrote:
    Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/4/2025 2:10 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:

    Now, for some fun wrt floating point issues... Have you messed around
    with storing data in the n-ary roots of complex numbers? they can actually create interesting renderings using real user data.

    https://groups.google.com/g/comp.lang.c++/c/bB1wA4wvoFc/m/ozDpUBlTAAAJ

    When you get really bored! ;^)

    Well, I no longer do Computer Graphics, with formulas, like for fractals
    etc. , or 3D CGI and 3D printing. Not sure if I ever will return to that.

    The only interests with graphics is, when it comes to encryption/decryption
    images.


    Fwiw, do you like stereograms? I created some with some of my depth maps
    created in GLSL shaders. Can you see this one:

    https://i.ibb.co/gwHwpFL/image.png

    Yes, I can see it.

    I have an idea about them. What about combining an anaglyph with a stereogram such that the observer would need to do the "eye trick" while
    wearing the red and blue glasses?

    I created in 1995, with Photoshop 2.5.1/3.0 a stereo image, which needs red/blue glasses. :-) I uploaded it to rarible.com as NFT for 50 ETH,
    but it is no longer there, nor on my harddrive. :-( It looked really really cool and was called ORIGAMI.

    Well,I found it on rarible.com, sorry my mistake.

    <https://rarible.com/token/0xc9154424b823b10579895ccbe442d41b9abd96ed:33722708843760813648285509687083650090679594480478541226033658120821450735646>

    use the maginfying glass to see the original size and use red/blues glasses to see the effect. :-)


    :^) I found one of my older anaglyphs I knew I posted before. the left
    hand side should seem to project "into" the screen, and the right one
    out of it. Can you see with with your red and blue goggles? glasses,
    lol. ;^) I had to use two cameras in my scene to do this. One for each
    eye of the observer.

    https://i.ibb.co/qm3jg4z/image.png

    https://www.facebook.com/photo/?fbid=135603427598664&set=pcb.135603700931970

    I can not find my glasses. It's been many years since I have used them.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Sun Jan 5 10:40:58 2025
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt it
    to finally post it. I can do this now with my xorpic program, but
    I thought a solution with AES-GCM or XChaCha20+ploy1305 is better.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Sun Jan 5 16:30:58 2025
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Sun Jan 5 16:36:00 2025
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt it
    to finally post it. I can do this now with my xorpic program, but I
    thought a solution with AES-GCM or XChaCha20+ploy1305 is better.

    The "path" I outlined in my previous post, where you utilize the netpbm
    image format as your 'intermediary' would allow you to use any generic encryption routine you like, while also allowing you to convert the
    encrypted binary data to/from an image format of your choice (well,
    your choice within the set of other formats for which NetPBM has
    to/from converters available).

    This frees you from having to understand the internal structure of the
    various image formats. You just work with the netpbm format (a raw
    binary bit/pixel block) for the encrypt/decrypt/padding operations, and delegate all the "image format" complexity to the netpbm library.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Rich on Sun Jan 5 20:50:11 2025
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt it
    to finally post it. I can do this now with my xorpic program, but I thought a solution with AES-GCM or XChaCha20+ploy1305 is better.

    The "path" I outlined in my previous post, where you utilize the netpbm
    image format as your 'intermediary' would allow you to use any generic encryption routine you like, while also allowing you to convert the
    encrypted binary data to/from an image format of your choice (well,
    your choice within the set of other formats for which NetPBM has
    to/from converters available).

    This frees you from having to understand the internal structure of the various image formats. You just work with the netpbm format (a raw
    binary bit/pixel block) for the encrypt/decrypt/padding operations, and delegate all the "image format" complexity to the netpbm library.

    Thank you! My ppmenc tool works nicely, here are the test images:

    https://jmp.sh/HZM9ML9f

    The big problem I face when converting the encryypted image to .png
    and back a diff shows a difference and the decryption fails.

    Maybe someone can figure out what to do, so that a converted .ppm
    can be posted online , for viewers/readers and then can be converted
    back to the original .ppm, which shows no difference.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Rich on Sun Jan 5 22:10:36 2025
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt
    it to finally post it. I can do this now with my xorpic program,
    but I thought a solution with AES-GCM or XChaCha20+ploy1305 is
    better.

    The "path" I outlined in my previous post, where you utilize the
    netpbm image format as your 'intermediary' would allow you to use
    any generic encryption routine you like, while also allowing you to convert the encrypted binary data to/from an image format of your
    choice (well, your choice within the set of other formats for which NetPBM has to/from converters available).

    This frees you from having to understand the internal structure of
    the various image formats. You just work with the netpbm format (a
    raw binary bit/pixel block) for the encrypt/decrypt/padding
    operations, and delegate all the "image format" complexity to the
    netpbm library.

    Thank you! My ppmenc tool works nicely, here are the test images:

    https://jmp.sh/HZM9ML9f

    The big problem I face when converting the encryypted image to .png
    and back a diff shows a difference and the decryption fails.

    Maybe someone can figure out what to do, so that a converted .ppm can
    be posted online , for viewers/readers and then can be converted back
    to the original .ppm, which shows no difference.

    We can't read your mind over Usenet so can you show how you converted
    the encrypted image to a png and back.


    I used Gimp with compression set to 0 and the netbmp tools.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Sun Jan 5 21:07:07 2025
    Stefan Claas <pollux@tilde.club> wrote:
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt
    it to finally post it. I can do this now with my xorpic program,
    but I thought a solution with AES-GCM or XChaCha20+ploy1305 is
    better.

    The "path" I outlined in my previous post, where you utilize the
    netpbm image format as your 'intermediary' would allow you to use
    any generic encryption routine you like, while also allowing you to
    convert the encrypted binary data to/from an image format of your
    choice (well, your choice within the set of other formats for which
    NetPBM has to/from converters available).

    This frees you from having to understand the internal structure of
    the various image formats. You just work with the netpbm format (a
    raw binary bit/pixel block) for the encrypt/decrypt/padding
    operations, and delegate all the "image format" complexity to the
    netpbm library.

    Thank you! My ppmenc tool works nicely, here are the test images:

    https://jmp.sh/HZM9ML9f

    The big problem I face when converting the encryypted image to .png
    and back a diff shows a difference and the decryption fails.

    Maybe someone can figure out what to do, so that a converted .ppm can
    be posted online , for viewers/readers and then can be converted back
    to the original .ppm, which shows no difference.

    We can't read your mind over Usenet so can you show how you converted
    the encrypted image to a png and back.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 23:18:10 2025
    Chris M. Thomasson wrote:
    On 1/5/2025 2:06 PM, Chris M. Thomasson wrote:
    On 1/5/2025 1:25 AM, Stefan Claas 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.


    Well, posting a png to say, facebook, well... It's probablly going to
    turn it into a jpg... This can ruin the embedded ciphertext in the png image...

    Actually, the damn FB allows me to send my links with embedded
    ciphertext just fine.

    It is for X and not Meta.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 23:21:48 2025
    Chris M. Thomasson wrote:
    On 1/5/2025 1:24 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/4/2025 4:21 PM, Stefan Claas 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.


    Well, take a good ol' bag o' bytes and turn it into a valid png?

    No, encrypt a .png, so that an encrypted noise image comes out.


    Are you talking about encrypting something A. Taking the resulting
    ciphertext B and creating a new png C out of B. The png C will have B a
    a visual entity. Now, since C has the ciphertext B in it, we can decrypt
    that data back into A.

    Is this what you are doing?

    I am talking about .png image encryption. I got it working for ppm (P6)
    files, so that when you have created with Gimp a ppm (raw) file it will
    then be encrypted with a password and salt and results in a noise image.

    Have you not seen my online folder with the example ... ???

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Sun Jan 5 23:40:50 2025
    Chris M. Thomasson wrote:
    On 1/5/2025 2:21 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/5/2025 1:24 AM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/4/2025 4:21 PM, Stefan Claas 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.


    Well, take a good ol' bag o' bytes and turn it into a valid png?

    No, encrypt a .png, so that an encrypted noise image comes out.


    Are you talking about encrypting something A. Taking the resulting ciphertext B and creating a new png C out of B. The png C will have B a
    a visual entity. Now, since C has the ciphertext B in it, we can decrypt that data back into A.

    Is this what you are doing?

    I am talking about .png image encryption. I got it working for ppm (P6) files, so that when you have created with Gimp a ppm (raw) file it will then be encrypted with a password and salt and results in a noise image.

    Have you not seen my online folder with the example ... ???


    The PPM still needs it proper format to be a, as you say, noise image?

    Are you not reading the complete thread, in which I have replied to Rich?

    I have worked a lot with PPM's. Keep in mind that storing ciphertext for
    any file, even the original PPM, JPG, ect, can be stored in another PPM
    for sure. So, the resulting PPM will have the payload of any file,
    another PPM, no problem. Then we can look at the payload as an image on
    the screen.

    Arrgh ... I am not talking about ciphertext or payload, I am talking about *Image Encryption*! I had that already in the mid 90s as Photoshop plug-in, from Japan.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Mon Jan 6 00:06:36 2025
    Chris M. Thomasson wrote:
    On 1/5/2025 2:48 PM, Chris M. Thomasson wrote:
    On 1/5/2025 1:10 PM, Stefan Claas wrote:
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt it to finally post it.  I can do this now with my xorpic program,
    but I thought a solution with AES-GCM or XChaCha20+ploy1305 is better.

    The "path" I outlined in my previous post, where you utilize the netpbm image format as your 'intermediary' would allow you to use any generic encryption routine you like, while also allowing you to convert the encrypted binary data to/from an image format of your choice (well, your choice within the set of other formats for which NetPBM has to/from converters available).

    This frees you from having to understand the internal structure of the various image formats.  You just work with the netpbm format (a
    raw binary bit/pixel block) for the encrypt/decrypt/padding operations, and delegate all the "image format" complexity to the netpbm library.

    Thank you!  My ppmenc tool works nicely, here are the test images:

    https://jmp.sh/HZM9ML9f

    The big problem I face when converting the encryypted image to .png and back a diff shows a difference and the decryption fails.

    Maybe someone can figure out what to do, so that a converted .ppm can be posted online , for viewers/readers and then can be converted back to the original .ppm, which shows no difference.

    We can't read your mind over Usenet so can you show how you converted the encrypted image to a png and back.


    I used Gimp with compression set to 0 and the netbmp tools.


    You should write your own program for it. The Gimp altered some bytes, right?

    Fwiw, the Cairo lib is fairly nice, well, to me at least... I use it a
    lot for my 2d work. it allows you to gain access to the raw underlying buffer. So, I can create PNG's with payloads that are intact.

    Ok, here is the deal ... I have file2png (Go and Python3) which converts
    any (encrypted) payload to valid noise .png images and back. I have xorpng
    in Go which can create .png keys of random noise (crypto/rand) and xor
    then .png images with them, to create encrypted noise images. I have ppmenc
    in Go which encrypts ppm (P6) images to noise images. What I can not work
    out is to convert a ppm to .png and back to the *original* .ppm (P6) file, because .png with programs used or the Go library alter the conversion,
    back to .ppm (P6). I tried many things and always failed.

    *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!

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Chris M. Thomasson on Mon Jan 6 01:07:42 2025
    Chris M. Thomasson wrote:
    On 1/5/2025 3:06 PM, Stefan Claas wrote:
    Chris M. Thomasson 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!

    Still, try this:

    Upload a PNG to X and/or FB. Copy the image, download the image from
    them after its up on their site. Do a file compare on it wrt your
    original source PNG. Are the exactly the same?

    On X they are the same, once downloaded, which a 'diff' shows. ;-)

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Mon Jan 6 01:22:48 2025
    Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/5/2025 3:06 PM, Stefan Claas wrote:
    Chris M. Thomasson 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!

    Still, try this:

    Upload a PNG to X and/or FB. Copy the image, download the image from
    them after its up on their site. Do a file compare on it wrt your
    original source PNG. Are the exactly the same?

    On X they are the same, once downloaded, which a 'diff' shows. ;-)

    BTW. I come to the conclusion that it is best to use 'age' without
    the -a option and then my file2png program ... This allows one to
    encrypt any kind of data and convert it as valid noise .png image,
    for X and other online usage. The advantage of 'age' is that it
    uses public key cryptography or symmetric encryption. Better not
    to invent the wheel twice. Anyways interesting thread ... :-)

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Mon Jan 6 01:46:50 2025
    Stefan Claas wrote:
    Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/5/2025 3:06 PM, Stefan Claas wrote:
    Chris M. Thomasson 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!

    Still, try this:

    Upload a PNG to X and/or FB. Copy the image, download the image from
    them after its up on their site. Do a file compare on it wrt your original source PNG. Are the exactly the same?

    On X they are the same, once downloaded, which a 'diff' shows. ;-)

    BTW. I come to the conclusion that it is best to use 'age' without
    the -a option and then my file2png program ... This allows one to
    encrypt any kind of data and convert it as valid noise .png image,
    for X and other online usage. The advantage of 'age' is that it
    uses public key cryptography or symmetric encryption. Better not
    to invent the wheel twice. Anyways interesting thread ... :-)

    And plug-ins for 'age' exists, which allows Yubikey or TPM usage. :-)

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Mon Jan 6 03:29:32 2025
    Stefan Claas <pollux@tilde.club> wrote:
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Rich wrote:
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    I.e, first you put data with file2png in a .png and then encrypt
    it to finally post it. I can do this now with my xorpic program,
    but I thought a solution with AES-GCM or XChaCha20+ploy1305 is
    better.

    The "path" I outlined in my previous post, where you utilize the
    netpbm image format as your 'intermediary' would allow you to use
    any generic encryption routine you like, while also allowing you to
    convert the encrypted binary data to/from an image format of your
    choice (well, your choice within the set of other formats for which
    NetPBM has to/from converters available).

    This frees you from having to understand the internal structure of
    the various image formats. You just work with the netpbm format (a
    raw binary bit/pixel block) for the encrypt/decrypt/padding
    operations, and delegate all the "image format" complexity to the
    netpbm library.

    Thank you! My ppmenc tool works nicely, here are the test images:

    https://jmp.sh/HZM9ML9f

    The big problem I face when converting the encryypted image to .png
    and back a diff shows a difference and the decryption fails.

    Maybe someone can figure out what to do, so that a converted .ppm can
    be posted online , for viewers/readers and then can be converted back
    to the original .ppm, which shows no difference.

    We can't read your mind over Usenet so can you show how you converted
    the encrypted image to a png and back.


    I used Gimp with compression set to 0 and the netbmp tools.

    "compression set to 0" -- meaningless with ppm, there is no
    'compression' for any ppm image format. The only options GIMP offers
    for "ppm" files is "RAW" vs "ASCII".

    I still am unable to read your mind and divine how you converted the
    ppm to a png. What exact command did you run?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Chris M. Thomasson on Mon Jan 6 03:44:43 2025
    Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
    On 1/5/2025 1:25 AM, Stefan Claas 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.


    Well, posting a png to say, facebook, well... It's probablly going to
    turn it into a jpg... This can ruin the embedded ciphertext in the png image...

    ebay seems to recently be converting jpeg's into webp's after one
    uploads them, which would also alter the stored bitmap (as webp is
    lossy). Although given the volume of image data they handle, if webp
    is even 5% smaller than jpegs, it becomes a huge storage savings for
    them.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Mon Jan 6 03:42:01 2025
    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.png

    Wikipedia page where the image is linked: https://en.wikipedia.org/wiki/Electronic_codebook

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Chris M. Thomasson on Mon Jan 6 03:50:15 2025
    Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
    On 1/5/2025 2:18 PM, Stefan Claas wrote:
    Chris M. Thomasson wrote:
    On 1/5/2025 2:06 PM, Chris M. Thomasson wrote:
    On 1/5/2025 1:25 AM, Stefan Claas 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.


    Well, posting a png to say, facebook, well... It's probablly going to
    turn it into a jpg... This can ruin the embedded ciphertext in the png >>>> image...

    Actually, the damn FB allows me to send my links with embedded
    ciphertext just fine.

    It is for X and not Meta.


    Well, sending say a PNG to X, it still might convert it into a JPG. It
    might alter things for compression purposes. This can mess around with
    your payload...

    There are several "modifications" to a PNG that can be performed, that
    for a photo or a "meme image" will not result in visible changes, but
    *will* result in changes to the bitmap.

    Several possibilities are:

    1) convert RGBA to just RGB (remove alpha channel) -- if one created a
    "crypto carrier" PNG that used an alpha channel, this conversion would
    delete 25% of the data content.

    2) convert RGB (24 bits per pixel) to indexed (either eight or sixteen
    bits per pixel). Both require color mapping from 2^24 colors to either
    2^8 or 2^16 total colors, resulting in an altered bitmap.

    3) convert RGB or indexed images into a "low color" index image (i.e.,
    max 64 colors) which requires the same color mapping as #2 above, and
    will create a different bitmap.

    Simply uploading a PNG to X, then downloading the PNG X serves, and
    identifying it as a "PNG" does not tell the full story. You have to
    look at what "kind" of PNG was uploaded, and what "kind" of PNG
    returned, to know what transformations X performed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Mon Jan 6 15:04:57 2025
    Stefan Claas 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.

    Welln ot true, but the paading byte causes the issue, because it gets
    lost when converting.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Rich on Mon Jan 6 14:52:38 2025
    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.

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Claas@21:1/5 to Stefan Claas on Mon Jan 6 19:49:01 2025
    Stefan Claas wrote:
    Stefan Claas 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.

    Welln ot true, but the paading byte causes the issue, because it gets
    lost when converting.

    I will use encryption and then file2png, which makes the noise image
    smaller in size, compared to the original image.

    https://github.com/706f6c6c7578/file2png

    --
    Regards
    Stefan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Mon Jan 6 22:15:22 2025
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Stefan Claas on Mon Jan 6 23:51:12 2025
    Stefan Claas <pollux@tilde.club> wrote:
    Stefan Claas 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.

    Welln ot true, but the paading byte causes the issue, because it gets
    lost when converting.

    When you pick an image matrix size, that size must include all bytes,
    including any padding necessary, in the data you want to make into an
    image.

    I.e., the image matrix has to be exactly the number of bytes of the
    data after adding any headers and any padding.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jan Panteltje@21:1/5 to pollux@tilde.club on Tue Jan 7 05:56:52 2025
    On a sunny day (Mon, 6 Jan 2025 19:49:01 +0100) it happened Stefan Claas <pollux@tilde.club> wrote in <vlh8it$14fe4$1@paganini.bofh.team>:

    Stefan Claas wrote:
    Stefan Claas 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. >>
    Welln ot true, but the paading byte causes the issue, because it gets
    lost when converting.

    I will use encryption and then file2png, which makes the noise image
    smaller in size, compared to the original image.

    https://github.com/706f6c6c7578/file2png

    All nice stuff, but an image with just noise makes one suspicious..
    and than have a go at hacking it perhaps

    Somehow embed the noise in a real image, like one looking at a TV with noise.. 'my TV failed'
    Bit more complicated to code... sub=area of the image.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)