Discussion:
Ternary Encoding :-)
Add Reply
Stefan Claas
2025-01-01 01:00:36 UTC
Reply
Permalink
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.)
--
Regards
Stefan
Stefan Claas
2025-01-01 16:24:30 UTC
Reply
Permalink
Post by Stefan Claas
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.)
The nice thing is we can like xor use ternary exclusive or (txor)
to encrypt/decrypt messages. :-)

$ echo 'Happy News Year 2025' | ternary > message.txt
$ txor -k k-1.txt < message.txt > message_encrypted.txt
$ txor -k k-1.txt -d < message_encrypted.txt > message_decrypted.txt
$ ternary -d < message_decrypted.txt
Happy News Year 2025
--
Regards
Stefan
Rich
2025-01-01 18:24:10 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
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.)
The nice thing is we can like xor use ternary exclusive or (txor)
to encrypt/decrypt messages. :-)
$ echo 'Happy News Year 2025' | ternary > message.txt
$ txor -k k-1.txt < message.txt > message_encrypted.txt
$ txor -k k-1.txt -d < message_encrypted.txt > message_decrypted.txt
$ ternary -d < message_decrypted.txt
Happy News Year 2025
How does "ternary exclusive or" differ from the usual boolean xor?

Provided one can "xor" binary data, there's zero need for any odd
'encoding specific' xor operation. Just do a binary xor and be done.

Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Stefan Claas
2025-01-01 19:25:34 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
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.)
The nice thing is we can like xor use ternary exclusive or (txor)
to encrypt/decrypt messages. :-)
$ echo 'Happy News Year 2025' | ternary > message.txt
$ txor -k k-1.txt < message.txt > message_encrypted.txt
$ txor -k k-1.txt -d < message_encrypted.txt > message_decrypted.txt
$ ternary -d < message_decrypted.txt
Happy News Year 2025
How does "ternary exclusive or" differ from the usual boolean xor?
The usual Boolean XOR (exclusive or) operation takes two binary inputs
and returns true (1) if exactly one of the inputs is true (1), and false
(0) otherwise.

Ternary XOR takes three binary inputs and returns true (1) if an odd
number of the inputs are true (1).

The ternary XOR differs from the usual XOR in that it considers three
inputs instead of two and returns true when an odd number of these
inputs are true.
Post by Rich
Provided one can "xor" binary data, there's zero need for any odd
'encoding specific' xor operation. Just do a binary xor and be done.
I wanted to visualize with the numbers 0,1,2 the Ternary numbers,
in an encoding scheme for ASCII transmission of the payload and that
the output can be compared with:

https://calculator.name/baseconvert/hexadecimal/ternary/
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Use it locally with your best friends. :-)
--
Regards
Stefan
Stefan Claas
2025-01-01 19:48:30 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
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.)
The nice thing is we can like xor use ternary exclusive or (txor)
to encrypt/decrypt messages. :-)
$ echo 'Happy News Year 2025' | ternary > message.txt
$ txor -k k-1.txt < message.txt > message_encrypted.txt
$ txor -k k-1.txt -d < message_encrypted.txt > message_decrypted.txt
$ ternary -d < message_decrypted.txt
Happy News Year 2025
How does "ternary exclusive or" differ from the usual boolean xor?
The usual Boolean XOR (exclusive or) operation takes two binary inputs
and returns true (1) if exactly one of the inputs is true (1), and false
(0) otherwise.
Ternary XOR takes three binary inputs and returns true (1) if an odd
number of the inputs are true (1).
XOR:

A B A⊕B
0 0 0
0 1 1
1 0 1
1 1 0

Ternary XOR:

A B C A⊕B⊕C
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
--
Regards
Stefan
Stefan Claas
2025-01-01 20:04:08 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
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.)
The nice thing is we can like xor use ternary exclusive or (txor)
to encrypt/decrypt messages. :-)
$ echo 'Happy News Year 2025' | ternary > message.txt
$ txor -k k-1.txt < message.txt > message_encrypted.txt
$ txor -k k-1.txt -d < message_encrypted.txt > message_decrypted.txt
$ ternary -d < message_decrypted.txt
Happy News Year 2025
How does "ternary exclusive or" differ from the usual boolean xor?
The usual Boolean XOR (exclusive or) operation takes two binary inputs
and returns true (1) if exactly one of the inputs is true (1), and false
(0) otherwise.
Ternary XOR takes three binary inputs and returns true (1) if an odd
number of the inputs are true (1).
A B A⊕B
0 0 0
0 1 1
1 0 1
1 1 0
A B C A⊕B⊕C
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
$ echo -n 'Hello sci.crypt!' > message.txt

$ ternary < message.txt
1221201211220001100200101212212002212101111121202210002002121022
1111101022101001

$ xxd -ps < message.txt
48656c6c6f207363692e637279707421

<https://www.webconversiononline.com/number-conversion.aspx?number=48656c6c6f207363692e637279707421&from=hexadecimal&to=ternary>
--
Regards
Stefan
Rich
2025-01-01 22:19:13 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
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.)
The nice thing is we can like xor use ternary exclusive or (txor)
to encrypt/decrypt messages. :-)
$ echo 'Happy News Year 2025' | ternary > message.txt
$ txor -k k-1.txt < message.txt > message_encrypted.txt
$ txor -k k-1.txt -d < message_encrypted.txt > message_decrypted.txt
$ ternary -d < message_decrypted.txt
Happy News Year 2025
How does "ternary exclusive or" differ from the usual boolean xor?
The usual Boolean XOR (exclusive or) operation takes two binary inputs
and returns true (1) if exactly one of the inputs is true (1), and false
(0) otherwise.
Ternary XOR takes three binary inputs and returns true (1) if an odd
number of the inputs are true (1).
A B A⊕B
0 0 0
0 1 1
1 0 1
1 1 0
A B C A⊕B⊕C
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
Or simply "even parity".

https://en.wikipedia.org/wiki/Parity_bit
Rich
2025-01-01 22:16:51 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution
and key reuse problems.
Use it locally with your best friends. :-)
You still have a "distribution" problem, in that each "key file" must
be used only once. So you still have to get fresh pads to your
friends.

You've reduced the scale from "getting OTPs behind enemy lines" to
"getting OTPs to friends". But it still exists.
Stefan Claas
2025-01-01 22:12:56 UTC
Reply
Permalink
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)

I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions, which
others afaik have not thought of (yet).
--
Regards
Stefan
Rich
2025-01-01 22:20:32 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Stefan Claas
2025-01-02 00:28:30 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.

I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.

In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.

Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).

This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
--
Regards
Stefan
Rich
2025-01-02 04:31:11 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.

Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.

Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
Stefan Claas
2025-01-02 14:18:05 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.
Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.
Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
That is old saying , that it is only unbreakable with TRRNG. I believe
that nowadays PRNG can serve the purpose as well, for OTP encryption.

What patterns would distinguish a TRNG and PRNG OTP sheet, if a
cryptanalist would look at them, or when looking at a couple of
more sheets? The difference is IMHO none.
--
Regards
Stefan
Stefan Claas
2025-01-02 15:02:38 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.
Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.
Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
That is old saying , that it is only unbreakable with TRRNG. I believe
that nowadays PRNG can serve the purpose as well, for OTP encryption.
What patterns would distinguish a TRNG and PRNG OTP sheet, if a
cryptanalist would look at them, or when looking at a couple of
more sheets? The difference is IMHO none.
Example, 60 dice rolls from random.org and Go's crypto/rand

random.org:
2 4 4 4 4 5 4 6 1 2 2 1 5 6 4
5 6 4 2 2 5 3 6 1 3 1 4 1 6 4
2 1 2 2 2 2 2 2 3 1 1 2 6 1 6
5 1 6 5 5 4 3 1 3 6 6 5 1 3 1

Go crypt/rand:
3 5 6 3 4 5 4 1 1 6 1 5 3 2 4
3 5 1 1 6 5 3 2 3 1 1 6 3 3 3
5 3 6 3 1 2 1 6 1 1 4 1 1 5 5
1 6 3 6 6 1 4 6 1 3 2 2 1 4 1
--
Regards
Stefan
Rich
2025-01-02 18:38:26 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.
Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.
Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
That is old saying , that it is only unbreakable with TRRNG. I believe
that nowadays PRNG can serve the purpose as well, for OTP encryption.
What patterns would distinguish a TRNG and PRNG OTP sheet, if a
cryptanalist would look at them, or when looking at a couple of
more sheets? The difference is IMHO none.
Example, 60 dice rolls from random.org and Go's crypto/rand
2 4 4 4 4 5 4 6 1 2 2 1 5 6 4
5 6 4 2 2 5 3 6 1 3 1 4 1 6 4
2 1 2 2 2 2 2 2 3 1 1 2 6 1 6
5 1 6 5 5 4 3 1 3 6 6 5 1 3 1
3 5 6 3 4 5 4 1 1 6 1 5 3 2 4
3 5 1 1 6 5 3 2 3 1 1 6 3 3 3
5 3 6 3 1 2 1 6 1 1 4 1 1 5 5
1 6 3 6 6 1 4 6 1 3 2 2 1 4 1
In just this one sample, go crypt/rand shows a bias (I'm surprised it
showed with such a small sample size). Larger samples will likely show
other biases:

random.org

count die face
13 1
13 2
6 3
10 4
8 5
10 6

go

count die face
18 1
5 2
13 3
6 4
8 5
10 6

go rolled a "1" 18 times (random.org rolled no single face more than 13
times). It also under-rolled a "2" vs. the lowest count face
random.org returned.

And finding that simple bias only needed 'sort' and 'uniq' to do so.
Running them through something like the die harder tests would likely
show other results.
Stefan Claas
2025-01-02 23:25:15 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.
Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.
Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
That is old saying , that it is only unbreakable with TRRNG. I believe
that nowadays PRNG can serve the purpose as well, for OTP encryption.
What patterns would distinguish a TRNG and PRNG OTP sheet, if a
cryptanalist would look at them, or when looking at a couple of
more sheets? The difference is IMHO none.
Example, 60 dice rolls from random.org and Go's crypto/rand
2 4 4 4 4 5 4 6 1 2 2 1 5 6 4
5 6 4 2 2 5 3 6 1 3 1 4 1 6 4
2 1 2 2 2 2 2 2 3 1 1 2 6 1 6
5 1 6 5 5 4 3 1 3 6 6 5 1 3 1
3 5 6 3 4 5 4 1 1 6 1 5 3 2 4
3 5 1 1 6 5 3 2 3 1 1 6 3 3 3
5 3 6 3 1 2 1 6 1 1 4 1 1 5 5
1 6 3 6 6 1 4 6 1 3 2 2 1 4 1
In just this one sample, go crypt/rand shows a bias (I'm surprised it
showed with such a small sample size). Larger samples will likely show
random.org
count die face
13 1
13 2
6 3
10 4
8 5
10 6
go
count die face
18 1
5 2
13 3
6 4
8 5
10 6
go rolled a "1" 18 times (random.org rolled no single face more than 13
times). It also under-rolled a "2" vs. the lowest count face
random.org returned.
And finding that simple bias only needed 'sort' and 'uniq' to do so.
Running them through something like the die harder tests would likely
show other results.
Now I have used my PC's internal TRNG (TPM 2.0 Chip) via Go, instead of
crypt/rand and the process is slower but looks like this:

4 4 3 6 3 6 3 4 4 6 4 2 1 5 1
1 5 6 6 1 1 6 3 1 2 5 6 1 2 4
2 4 2 3 5 1 2 6 5 1 2 1 2 5 3
1 4 5 5 6 6 3 5 2 5 5 6 4 2 2

5 3 1 5 2 4 5 4 6 1 1 3 4 5 4
3 2 5 4 4 4 6 3 1 5 6 6 2 6 2
2 4 5 5 5 5 2 6 5 6 3 3 3 1 6
3 3 2 2 3 6 5 3 2 2 1 6 6 4 6

1 4 5 3 4 3 1 6 3 2 1 1 6 3 4
6 5 2 4 3 3 3 5 1 4 2 5 4 3 3
3 4 5 2 5 3 1 4 6 1 6 3 2 5 6
5 4 6 4 6 6 2 4 2 2 6 4 4 1 4
--
Regards
Stefan
Rich
2025-01-03 02:38:53 UTC
Reply
Permalink
Post by Stefan Claas
Now I have used my PC's internal TRNG (TPM 2.0 Chip) via Go, instead of
4 4 3 6 3 6 3 4 4 6 4 2 1 5 1
1 5 6 6 1 1 6 3 1 2 5 6 1 2 4
2 4 2 3 5 1 2 6 5 1 2 1 2 5 3
1 4 5 5 6 6 3 5 2 5 5 6 4 2 2
5 3 1 5 2 4 5 4 6 1 1 3 4 5 4
3 2 5 4 4 4 6 3 1 5 6 6 2 6 2
2 4 5 5 5 5 2 6 5 6 3 3 3 1 6
3 3 2 2 3 6 5 3 2 2 1 6 6 4 6
1 4 5 3 4 3 1 6 3 2 1 1 6 3 4
6 5 2 4 3 3 3 5 1 4 2 5 4 3 3
3 4 5 2 5 3 1 4 6 1 6 3 2 5 6
5 4 6 4 6 6 2 4 2 2 6 4 4 1 4
The sort uniq 'distribution' now looks like this for the above:

count die face
25 1
29 2
30 3
32 4
31 5
33 6

Would have to run the 'rolls' throuogh die harder to learn any more.
Rich
2025-01-02 18:25:57 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.
Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.
Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
That is old saying , that it is only unbreakable with TRRNG. I believe
that nowadays PRNG can serve the purpose as well, for OTP encryption.
You can believe what you wish. But for your belief to be accepted by
more than yourself you'll need to show a proof of such. Neither of us
being a "cryptographer" I'll continue to believe the existing proofs
that for an OTP to be secure the pad needs to be generated from a true
random source.
Post by Stefan Claas
What patterns would distinguish a TRNG and PRNG OTP sheet, if a
cryptanalist would look at them, or when looking at a couple of
more sheets? The difference is IMHO none.
Any deterministic generator system (i.e., a PRNG) is going to have some
bias somewhere (possibly not noticable until a significant number of
outputs are analyzed). It will be that bias that will provide the
crack through which an actual cryptographer will break the system.
Stefan Claas
2025-01-02 23:29:33 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Forgot to mention, not with my programs, because also in this case I
can use for ternary xor encryption deterministic keys, valid for one
day (UTC +0000), so that border control does not find keys. :-)
You'll have to explain further, as the above is not nearly enough
explanation to understand what you are discussing.
Post by Stefan Claas
I have made this a standard for some of my programs, because long ago
I thought of key distribution problems and looked for solutions,
which others afaik have not thought of (yet).
Further explanation needed.
Ok. You talked about key distribution problems with OTPs and management.
I have Go programs which can generate as many random keys/pads per day
(UTC +0000) for my programs, based on a shared secret, consisting of
a password and salt.
In order that this works Alice and Bob needs only one initial session,
where they transfer with a client/server program, which uses DHE/AES-GCM,
the shared secret via the Tor Network, to bypass third party servers
and NAT etc.
Once the shared secret is transfered securely to Alice or Bob, they use
the key generation programs, which are deterministic. This means that
when Alice generates todays pads/keys she does not need to transfer them
to Bob, because Bob has the shared secret and can generate the same
determenistic keys for each day (UTC +0000).
This procedure allows either Alice or Bob to travel, without worring that
some border patrol finds pads/keys, for daily usage, or If I would do
encryption with you without sending you pads in advance, via postal
service etc.
Then the weakness here is this "generator algorithm". A OTP is only
perfectly secure if the pads are true random sequences.
Deterministic outputs from a seeded generator are not "true random
sequences" so you will not gain the "unbreakable" aspect of a proper
OTP.
Will it likely be /good enough/ such that those of us left here are
unlikely to break it: yes. Will it be good enough that one of the
three-letter-agencies cannot break it: likely no.
That is old saying , that it is only unbreakable with TRRNG. I believe
that nowadays PRNG can serve the purpose as well, for OTP encryption.
You can believe what you wish. But for your belief to be accepted by
more than yourself you'll need to show a proof of such. Neither of us
being a "cryptographer" I'll continue to believe the existing proofs
that for an OTP to be secure the pad needs to be generated from a true
random source.
Post by Stefan Claas
What patterns would distinguish a TRNG and PRNG OTP sheet, if a
cryptanalist would look at them, or when looking at a couple of
more sheets? The difference is IMHO none.
Any deterministic generator system (i.e., a PRNG) is going to have some
bias somewhere (possibly not noticable until a significant number of
outputs are analyzed). It will be that bias that will provide the
crack through which an actual cryptographer will break the system.
Like with my previous reply I use now my PC's internal TRNG (TPM 2.0 Chip)
with Go and can now generate true random ternary numbers for OTP sheets. :-)

These are now not deterministic and the key distribution problem comes up,
but at least this was a learning exercise and I may update other Go programs
of mine.
--
Regards
Stefan
Stefan Claas
2025-01-03 01:04:21 UTC
Reply
Permalink
Post by Stefan Claas
These are now not deterministic and the key distribution problem comes up,
but at least this was a learning exercise and I may update other Go programs
of mine.
For the key distribion over the Internet I work on a solution with Tor Hidden
Services and Diffie-Hellman key exchange, using AES-GCM.

My old pads program is already updated. It compiled flawlessly for many
different platforms, including macOS, but I do not know if they all support
TPM 2.0, like Windows and Linux does.

https://github.com/706f6c6c7578/pads
--
Regards
Stefan
Rich
2025-01-03 02:41:15 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
These are now not deterministic and the key distribution problem comes up,
but at least this was a learning exercise and I may update other Go programs
of mine.
For the key distribion over the Internet I work on a solution with Tor Hidden
Services and Diffie-Hellman key exchange, using AES-GCM.
My old pads program is already updated. It compiled flawlessly for many
different platforms, including macOS, but I do not know if they all support
TPM 2.0, like Windows and Linux does.
It is not so much 'support' TPM as it is "includes" a TPM. If the
machine does not have one (and many not so old and older systems do
not) then there is not one present to use in any fashion.
Rich
2025-01-03 05:03:20 UTC
Reply
Permalink
My old pads program is already updated. It compiled flawlessly for
many different platforms, including macOS, but I do not know if they
all support TPM 2.0, like Windows and Linux does.
https://github.com/706f6c6c7578/pads
Looking over your pads program, while you are retreiving true random
numbers from the TPM chip, you are introducing a bias when you use the
random bytes from the TPM to output letters or digits.

Take for example your "letters" arm:

if l {
random, _ := tpm2.GetRandom(rwc, 5)
for m := 0; m < 5; m++ {
fmt.Printf("%c", 'A'+(random[m]%26))
}
}

Now, if I've decoded the awful documentation for the TPM2 module
properly [1] the tpm2.GetRandom call will return five bytes (presumably
unsigned bytes) of random data.

Then, you loop over the five bytes, outputting the letter that
corresponds to ASCII A plus the remainder after dividing the byte by
26. Which is where you introduce a bias.

A byte will have a value from 0 to 255, for 256 total values.

But 26 does not evenly divide 256. 256/26 ~ 9.846

26 divides 256 evenly 9 times, no problem here. That covers values 0
to 233. But for any bytes returned from GetRandom that fall into the
range 234 to 255, you have only 21 possible values that can return from
the modulo. So your remainder will be only 0 through 21. You'll never
get 22 through 25 out, because there is not enough numeric range in the
"tail" to return 22 through 25 from the modulo. So for any bytes with
values 234 to 255 from the TPM, you can return A through V but will
never return W, X, Y or Z.

So your resulting letters will have a bias for A through V.

The fix is easy, first check the value of the byte you are about to
use, and if it happens to be greater than 233, throw that byte away and
pull another from the TPM.

You produce the same bias for your digits, since an unsigned three byte
value is 2^24 = 16_777_216 but that is not evenly divisible by 100000.
So you'll have a range of "low numbers" that are slightly more likely
to occur (a bias) than they should if they were truly random.

This is one of the many examples where it is very easy to mess up the
implementation of a crypto system such that a crack is left for a
skilled cryptographer to exploit.


[1] it is actually worse than awful, it is non-existant, but that seems
to be a normal given aspect for most of the 'newfangled' languages
out there, no documentation in sight anywhere
Stefan Claas
2025-01-03 14:40:48 UTC
Reply
Permalink
Post by Rich
My old pads program is already updated. It compiled flawlessly for
many different platforms, including macOS, but I do not know if they
all support TPM 2.0, like Windows and Linux does.
https://github.com/706f6c6c7578/pads
Looking over your pads program, while you are retreiving true random
numbers from the TPM chip, you are introducing a bias when you use the
random bytes from the TPM to output letters or digits.
if l {
random, _ := tpm2.GetRandom(rwc, 5)
for m := 0; m < 5; m++ {
fmt.Printf("%c", 'A'+(random[m]%26))
}
}
Now, if I've decoded the awful documentation for the TPM2 module
properly [1] the tpm2.GetRandom call will return five bytes (presumably
unsigned bytes) of random data.
Then, you loop over the five bytes, outputting the letter that
corresponds to ASCII A plus the remainder after dividing the byte by
26. Which is where you introduce a bias.
A byte will have a value from 0 to 255, for 256 total values.
But 26 does not evenly divide 256. 256/26 ~ 9.846
26 divides 256 evenly 9 times, no problem here. That covers values 0
to 233. But for any bytes returned from GetRandom that fall into the
range 234 to 255, you have only 21 possible values that can return from
the modulo. So your remainder will be only 0 through 21. You'll never
get 22 through 25 out, because there is not enough numeric range in the
"tail" to return 22 through 25 from the modulo. So for any bytes with
values 234 to 255 from the TPM, you can return A through V but will
never return W, X, Y or Z.
So your resulting letters will have a bias for A through V.
The fix is easy, first check the value of the byte you are about to
use, and if it happens to be greater than 233, throw that byte away and
pull another from the TPM.
You produce the same bias for your digits, since an unsigned three byte
value is 2^24 = 16_777_216 but that is not evenly divisible by 100000.
So you'll have a range of "low numbers" that are slightly more likely
to occur (a bias) than they should if they were truly random.
This is one of the many examples where it is very easy to mess up the
implementation of a crypto system such that a crack is left for a
skilled cryptographer to exploit.
[1] it is actually worse than awful, it is non-existant, but that seems
to be a normal given aspect for most of the 'newfangled' languages
out there, no documentation in sight anywhere
Excellent observation! Thanks a lot, much appreciated! The Go code and
binaries are now updated, according to your suggestions.
--
Regards
Stefan
Chax Plore
2025-01-08 16:09:09 UTC
Reply
Permalink
Post by Rich
My old pads program is already updated. It compiled flawlessly for
many different platforms, including macOS, but I do not know if they
all support TPM 2.0, like Windows and Linux does.
https://github.com/706f6c6c7578/pads
Looking over your pads program, while you are retreiving true random
numbers from the TPM chip, you are introducing a bias when you use the
random bytes from the TPM to output letters or digits.
if l {
random, _ := tpm2.GetRandom(rwc, 5)
for m := 0; m < 5; m++ {
fmt.Printf("%c", 'A'+(random[m]%26))
}
}
Now, if I've decoded the awful documentation for the TPM2 module
properly [1] the tpm2.GetRandom call will return five bytes (presumably
unsigned bytes) of random data.
Then, you loop over the five bytes, outputting the letter that
corresponds to ASCII A plus the remainder after dividing the byte by
26. Which is where you introduce a bias.
A byte will have a value from 0 to 255, for 256 total values.
But 26 does not evenly divide 256. 256/26 ~ 9.846
26 divides 256 evenly 9 times, no problem here. That covers values 0
to 233. But for any bytes returned from GetRandom that fall into the
range 234 to 255, you have only 21 possible values that can return from
the modulo. So your remainder will be only 0 through 21. You'll never
get 22 through 25 out, because there is not enough numeric range in the
"tail" to return 22 through 25 from the modulo. So for any bytes with
values 234 to 255 from the TPM, you can return A through V but will
never return W, X, Y or Z.
So your resulting letters will have a bias for A through V.
The fix is easy, first check the value of the byte you are about to
use, and if it happens to be greater than 233, throw that byte away and
pull another from the TPM.
Why waste 8.98% of random bytes, especially when generating large keys
from slow source of randomness? Lumbroso's FastDiceRoller algorithm
consumes the exact number of bits needed to produce integer in requested
range: https://arxiv.org/abs/1304.1916


Exhibit 1:
inline uint32_t FastDiceRoller(unsigned int n) {
uint64_t v = 1, c = 0;
while (true) {
v = v << 1;
c = (c << 1) + randombit;
if (v >= n) {
if (c < n) return c;
else {
v = v - n;
c = c - n;
}
}
}
}

Exhibit 2:
function FastDiceRoller(const n: longword): longword;
var
v, c: Int64;
begin
v := 1;
c := 0;
while (true) do
begin
v := (v shl 1);
c := (c shl 1) + RandomBit;
if (v >= n) then
begin
if (c < n) then
begin
result := LongWord(c);
Exit;
end
else
begin
v := v - n;
c := c - n;
end;
end;
end;
end;
--
-----BEGIN PGP PUBLIC KEY FINGERPRINT-----
5745 807C 2B82 14D8 AB06 422C 8876 5DFC 2A51 778C
------END PGP PUBLIC KEY FINGERPRINT------
Rich
2025-01-08 17:07:20 UTC
Reply
Permalink
Post by Chax Plore
Post by Rich
My old pads program is already updated. It compiled flawlessly for
many different platforms, including macOS, but I do not know if they
all support TPM 2.0, like Windows and Linux does.
https://github.com/706f6c6c7578/pads
Looking over your pads program, while you are retreiving true random
numbers from the TPM chip, you are introducing a bias when you use the
random bytes from the TPM to output letters or digits.
if l {
random, _ := tpm2.GetRandom(rwc, 5)
for m := 0; m < 5; m++ {
fmt.Printf("%c", 'A'+(random[m]%26))
}
}
Now, if I've decoded the awful documentation for the TPM2 module
properly [1] the tpm2.GetRandom call will return five bytes (presumably
unsigned bytes) of random data.
Then, you loop over the five bytes, outputting the letter that
corresponds to ASCII A plus the remainder after dividing the byte by
26. Which is where you introduce a bias.
A byte will have a value from 0 to 255, for 256 total values.
But 26 does not evenly divide 256. 256/26 ~ 9.846
26 divides 256 evenly 9 times, no problem here. That covers values 0
to 233. But for any bytes returned from GetRandom that fall into the
range 234 to 255, you have only 21 possible values that can return from
the modulo. So your remainder will be only 0 through 21. You'll never
get 22 through 25 out, because there is not enough numeric range in the
"tail" to return 22 through 25 from the modulo. So for any bytes with
values 234 to 255 from the TPM, you can return A through V but will
never return W, X, Y or Z.
So your resulting letters will have a bias for A through V.
The fix is easy, first check the value of the byte you are about to
use, and if it happens to be greater than 233, throw that byte away and
pull another from the TPM.
Why waste 8.98% of random bytes, especially when generating large
keys from slow source of randomness?
My post was to point out the bias, and offer a simple [1] solution that
is easy to understand.
Post by Chax Plore
Lumbroso's FastDiceRoller algorithm
consumes the exact number of bits needed to produce integer in requested
range: https://arxiv.org/abs/1304.1916
Interesting algorithm, thanks for the reference, although I'll have to
spend some time later giving it a go over to fully grok what it is
doing.


[1] Note that "simple" does not mean "optimal".

Chris M. Thomasson
2025-01-03 02:45:06 UTC
Reply
Permalink
Post by Stefan Claas
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

;^)
Stefan Claas
2025-01-03 15:13:52 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
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
https://paulbourke.org/fractals/multijulia
Nice, but I do no longer do Computer Graphics.
--
Regards
Stefan
Chris M. Thomasson
2025-01-03 21:59:43 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Stefan Claas
2025-01-04 18:06:29 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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
Stefan Claas
2025-01-04 18:53:57 UTC
Reply
Permalink
Post by Stefan Claas
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
Chris M. Thomasson
2025-01-04 21:00:58 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Post by Stefan Claas
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.
https://jmp.sh/jp1A5kvq
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.
Stefan Claas
2025-01-04 21:08:40 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Post by Stefan Claas
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.
https://jmp.sh/jp1A5kvq
https://github.com/706f6c6c7578/xorpng
https://github.com/706f6c6c7578/p4bm
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
Chris M. Thomasson
2025-01-04 21:13:05 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Post by Stefan Claas
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.
https://jmp.sh/jp1A5kvq
https://github.com/706f6c6c7578/xorpng
https://github.com/706f6c6c7578/p4bm
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! :^)
Chris M. Thomasson
2025-01-04 21:21:26 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Post by Stefan Claas
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.
https://jmp.sh/jp1A5kvq
https://github.com/706f6c6c7578/xorpng
https://github.com/706f6c6c7578/p4bm
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
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
Stefan Claas
2025-01-04 21:32:24 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Post by Stefan Claas
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.
https://jmp.sh/jp1A5kvq
https://github.com/706f6c6c7578/xorpng
https://github.com/706f6c6c7578/p4bm
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
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! :^)
http://funwithfractals.atspace.cc/ffe
Nice, but it does not decrypt the image, right, which should
be the task.
--
Regards
Stefan
Chris M. Thomasson
2025-01-04 21:51:40 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
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
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.
Post by Stefan Claas
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.
https://jmp.sh/jp1A5kvq
https://github.com/706f6c6c7578/xorpng
https://github.com/706f6c6c7578/p4bm
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
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! :^)
http://funwithfractals.atspace.cc/ffe
Nice, but it does not decrypt the image, right, which should
be the task.
That is not the task for my experiment here. Basically, it uses the
fractal image as a sort of "special pad", just for fun. You have all of
my code for it.

Wrt xor, decrypting the image would be just like encrypting it using any
xor cipher. You create a bitmap. Encrypt it using xor. Send the
ciphertext as a bitmap, or, well, I am thinking lossless here. Take the
bitmap, or png, and decrypt it using xor. Simple. If the resulting image
give any thing away wrt it's visual appearance, well, that is a sign
that the encryption algo is not all that good...

Now, using a lossy system is fun. I have experimented with this before
when I was bored. Alice encrypts using a jpg, then tries to decrypt the
lossy result. If that fails, Alice tries again wrt, say, adjusting
coloring, ect... Alice says okay! I finally found a lossy version of a
jpg that successfully encrypted and decrypted on my end. She finally
sends the jpg to Bob. Bob "should" be able to decrypt it because Alice
already did the encrypt and decrypt cycle on her end.

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! ;^)
Stefan Claas
2025-01-04 22:10:11 UTC
Reply
Permalink
Post by Chris M. Thomasson
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
Chris M. Thomasson
2025-01-04 22:31:12 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
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.
Stefan Claas
2025-01-04 23:56:16 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
Rich
2025-01-05 00:15:46 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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).
Stefan Claas
2025-01-05 00:21:43 UTC
Reply
Permalink
Post by Rich
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
Chris M. Thomasson
2025-01-05 03:26:27 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
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?
Stefan Claas
2025-01-05 09:24:02 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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
Chris M. Thomasson
2025-01-05 21:53:15 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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?
Chris M. Thomasson
2025-01-05 22:02:24 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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?
We can send C (the png) out as an "image file" that holds B (the
ciphertext) as a "payload"?
Stefan Claas
2025-01-05 22:21:48 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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
Chris M. Thomasson
2025-01-05 22:33:17 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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?

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.
Stefan Claas
2025-01-05 22:40:50 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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?
Post by Chris M. Thomasson
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
Chris M. Thomasson
2025-01-05 22:45:45 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
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?
Post by Chris M. Thomasson
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.
Sorry. When I think of image encryption, it still makes me think of Tux.

Then we can think of an image of the letter A. We send an image of X,
and say the key is X = A. I am sorry for missing your main point.
Rich
2025-01-05 06:17:47 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
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?
Stefan Claas
2025-01-05 09:25:45 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Rich
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
Stefan Claas
2025-01-05 09:40:58 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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
Rich
2025-01-05 16:36:00 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
Stefan Claas
2025-01-05 19:50:11 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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
Rich
2025-01-05 21:07:07 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
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.
Stefan Claas
2025-01-05 21:10:36 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
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
Chris M. Thomasson
2025-01-05 22:48:12 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
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?
Chris M. Thomasson
2025-01-05 22:50:53 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
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.
Stefan Claas
2025-01-05 23:06:36 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
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
Chris M. Thomasson
2025-01-05 23:17:42 UTC
Reply
Permalink
[...]
Post by Stefan Claas
*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?
Stefan Claas
2025-01-06 00:07:42 UTC
Reply
Permalink
Post by Chris M. Thomasson
[...]
Post by Stefan Claas
*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!
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
Stefan Claas
2025-01-06 00:22:48 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
[...]
Post by Stefan Claas
*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!
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
Stefan Claas
2025-01-06 00:46:50 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Chris M. Thomasson
[...]
Post by Stefan Claas
*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!
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
Chris M. Thomasson
2025-01-05 23:24:29 UTC
Reply
Permalink
On 1/5/2025 3:14 PM, Chris M. Thomasson wrote:
[...]

Ooops, I don't think that is my animation slice code, it just creates a
single frame. This one create multiple slices, or frames of the
volumetric if you will:

ct_anime is the function of interest.

Sorry about that:
____________________________________


/*
Experimental Power Stack Mandelbulb for Owen
By: Chris M. Thomasson
*_____________________________________________________________*/


#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <complex.h>
#include <tgmath.h>
#include <stdbool.h>


#define CT_WIDTH 256 // width of plane
#define CT_HEIGHT 256 // height of plane
#define CT_FRAMES 256 // slices of the mbulb
#define CT_ITERS 64 // iterations per pixel


/* The Canvas
___________________________________*/
struct ct_rgb
{
unsigned char r;
unsigned char g;
unsigned char b;
};


struct ct_canvas
{
unsigned long width;
unsigned long height;
struct ct_rgb* buf;
};

bool
ct_canvas_create(
struct ct_canvas* const self,
unsigned long width,
unsigned long height
){
size_t size = width * height * sizeof(*self->buf);

self->buf = calloc(1, size);

if (self->buf)
{
self->width = width;
self->height = height;

return true;
}

return false;
}

void
ct_canvas_destroy(
struct ct_canvas const* const self
){
free(self->buf);
}

bool
ct_canvas_save_ppm(
struct ct_canvas const* const self,
char const* fname
){
FILE* fout = fopen(fname, "wb");

if (fout)
{
char const ppm_head[] =
"P6\n"
"# Chris M. Thomasson Simple 2d Plane ver:0.0.0.0 (pre-alpha)";

fprintf(fout, "%s\n%lu %lu\n%u\n",
ppm_head,
self->width, self->height,
255U);

size_t size = self->width * self->height;

for (size_t i = 0; i < size; ++i)
{
//unsigned int c = self->buf[i];
struct ct_rgb* c = self->buf + i;

fprintf(fout, "%c%c%c", c->r, c->g, c->b);
}

if (! fclose(fout))
{
return true;
}
}

return false;
}



/* The Axes
___________________________________*/
struct ct_axes
{
double xmin;
double xmax;
double ymin;
double ymax;
};

struct ct_axes
ct_axes_from_point(
double complex z,
double radius
){
struct ct_axes axes = {
creal(z) - radius, creal(z) + radius,
cimag(z) - radius, cimag(z) + radius
};

return axes;
}



/* The Plane
___________________________________*/
struct ct_plane
{
struct ct_axes axes;
double xstep;
double ystep;
};


void
ct_plane_init(
struct ct_plane* const self,
struct ct_axes const* axes,
unsigned long width,
unsigned long height
){
self->axes = *axes;

double awidth = self->axes.xmax - self->axes.xmin;
double aheight = self->axes.ymax - self->axes.ymin;

assert(width > 0 && height > 0 && awidth > 0.0);

double daspect = fabs((double)height / width);
double waspect = fabs(aheight / awidth);

if (daspect > waspect)
{
double excess = aheight * (daspect / waspect - 1.0);
self->axes.ymax += excess / 2.0;
self->axes.ymin -= excess / 2.0;
}

else if (daspect < waspect)
{
double excess = awidth * (waspect / daspect - 1.0);
self->axes.xmax += excess / 2.0;
self->axes.xmin -= excess / 2.0;
}

self->xstep = (self->axes.xmax - self->axes.xmin) / width;
self->ystep = (self->axes.ymax - self->axes.ymin) / height;
}



/* The Plot
___________________________________*/
struct ct_plot
{
struct ct_plane plane;
struct ct_canvas* canvas;
};


void
ct_plot_init(
struct ct_plot* const self,
struct ct_axes const* axes,
struct ct_canvas* canvas
){
ct_plane_init(&self->plane, axes, canvas->width - 1, canvas->height
- 1);
self->canvas = canvas;
}


bool
ct_plot_add(
struct ct_plot* const self,
double complex z,
struct ct_rgb const* color
){
long x = (creal(z) - self->plane.axes.xmin) / self->plane.xstep;
long y = (self->plane.axes.ymax - cimag(z)) / self->plane.ystep;

if (x > -1 && x < (long)self->canvas->width &&
y > -1 && y < (long)self->canvas->height)
{
// Now, we can convert to index.
size_t i = x + y * self->canvas->width;

assert(i < self->canvas->height * self->canvas->width);

struct ct_rgb exist = self->canvas->buf[i];

exist.r += 1;

self->canvas->buf[i] = exist;
return true;
}

return true;
}


bool
ct_plot_pixel(
struct ct_plot* const self,
long x,
long y,
struct ct_rgb const* color
){
if (x > -1 && x < (long)self->canvas->width &&
y > -1 && y < (long)self->canvas->height)
{
// Now, we can convert to index.
size_t i = x + y * self->canvas->width;

assert(i < self->canvas->height * self->canvas->width);

self->canvas->buf[i] = *color;
return true;
}

return false;
}


void
ct_plot_clear(
struct ct_plot* const self,
struct ct_rgb const* color
){
size_t size = self->canvas->height * self->canvas->width;

for (size_t i = 0; i < size; ++i)
{
self->canvas->buf[i] = *color;
}
}


double complex
ct_project_to_xy(
struct ct_plot* const self,
long x,
long y
){
double complex p =
(self->plane.axes.xmin + x * self->plane.xstep) +
(self->plane.axes.ymax - y * self->plane.ystep) * I;

return p;
}


bool
ct_plot_point(
struct ct_plot* const self,
double complex z,
struct ct_rgb const* color
){
long x = (creal(z) - self->plane.axes.xmin) / self->plane.xstep;
long y = (self->plane.axes.ymax - cimag(z)) / self->plane.ystep;

if (x > -1 && x < (long)self->canvas->width &&
y > -1 && y < (long)self->canvas->height)
{
// Now, we can convert to index.
size_t i = x + y * self->canvas->width;

assert(i < self->canvas->height * self->canvas->width);

self->canvas->buf[i] = *color;
return true;
}

return false;
}


// slow, so what for now... ;^)
void ct_circle(
struct ct_plot* const plot,
double complex c,
double radius,
unsigned int n
){
double abase = 6.2831853071 / n;

for (unsigned int i = 0; i < n; ++i)
{
double angle = abase * i;

double complex z =
(creal(c) + cos(angle) * radius) +
(cimag(c) + sin(angle) * radius) * I;

struct ct_rgb rgb = { 255, 255, 255 };

ct_plot_point(plot, z, &rgb);
}
}



/* Simple vec3 for just what I need
___________________________________*/
struct ct_vec3
{
double x;
double y;
double z;
};


double ct_vev3_length(
struct ct_vec3 const p
){
double sum = p.x * p.x + p.y * p.y + p.z * p.z;
return sqrt(sum);
}


struct ct_vec3
ct_vec3_add(
struct ct_vec3 const p,
struct ct_vec3 const addend
){
struct ct_vec3 sum = {
p.x + addend.x,
p.y + addend.y,
p.z + addend.z
};

return sum;
}



/* The Power Stack Mandelbulb
___________________________________*/
void
ct_iterate_mbulb_pixel(
struct ct_plot* const plot,
struct ct_vec3 const z0,
struct ct_vec3 const c0,
double power,
long x,
long y,
unsigned int n
){
struct ct_vec3 zs = z0;
struct ct_vec3 cs = c0;

for (unsigned long i = 0; i < n; ++i)
{
double r = ct_vev3_length(zs);
double rpower = pow(r, power);

double angle0 = atan2(zs.z, sqrt(zs.x * zs.x + zs.y * zs.y));
double angle1 = atan2(zs.y, zs.x);

struct ct_vec3 znew;
znew.x = rpower * cos(power * angle1) * cos(power * angle0);
znew.y = rpower * sin(power * angle1) * cos(power * angle0);
znew.z = rpower * sin(power * angle0);

zs = ct_vec3_add(znew, cs);

if (r > 2.0)
{
return;
}
}

struct ct_rgb rgb = { 0, 255, 0 };
ct_plot_pixel(plot, x, y, &rgb);
}


// Gain the field...
void
ct_iterate_mbulb_plane(
struct ct_plot* const plot,
double zaxis,
double power,
unsigned int n
){
for (long y = 0; y < plot->canvas->height; ++y)
{
for (long x = 0; x < plot->canvas->width; ++x)
{
double complex cz = ct_project_to_xy(plot, x, y);

// Well, our per slice coords...
struct ct_vec3 z;

z.x = creal(cz);
z.y = cimag(cz);
z.z = zaxis;

// Iterate the slice
ct_iterate_mbulb_pixel(plot, z, z, power, x, y, n);
}

if (! (y % (plot->canvas->height / 10)))
{
printf("ct_iterate_mbulb_plane: %lu of %lu\r",
y + 1, plot->canvas->height);

fflush(stdout);
}
}

printf("ct_iterate_mbulb_plane: %lu of %lu\n\n",
plot->canvas->height, plot->canvas->height);

fflush(stdout);
}


/* The Animation Driver
___________________________________*/
void ct_anime(
struct ct_plot* const plot,
unsigned long frame_n,
unsigned long n
){
assert(frame_n > 0);

double zmin = 0.;
double zmax = 1.;
double zdif = zmax - zmin;
double zbase = zdif / (frame_n - 1.);

double pmin = 2.;
double pmax = 10.;
double pdif = pmax - pmin;
double pbase = pdif / (frame_n - 1.);

char fname[256] = { '\0' };

for (unsigned long frame_i = 0; frame_i < frame_n; ++frame_i)
{
double zaxis = zmin + zbase * frame_i;
double power = pmin + pbase * frame_i;

sprintf(fname, "ct_anime_%lu.ppm", frame_i);

printf("ct_anime: %lu of %lu, zaxis(%lf), power(%lf), (%s)\n",
frame_i, frame_n, zaxis, power, fname);

fflush(stdout);

struct ct_rgb black = { 0, 0, 0 };
ct_plot_clear(plot, &black);

ct_iterate_mbulb_plane(plot, zaxis, power, n);

ct_canvas_save_ppm(plot->canvas, fname);
}

printf("\n\nct_anime complete! %lu frames: \n", frame_n);
fflush(stdout);
}




void ct_test_plane(
struct ct_plot* const plot
){
printf("Generating...\n\n");
fflush(stdout);

ct_anime(plot, CT_FRAMES, CT_ITERS);
}


int main(void)
{
struct ct_canvas canvas;

if (ct_canvas_create(&canvas, CT_WIDTH, CT_HEIGHT))
{
double complex plane_origin = 0+0*I;
double plane_radius = 1.5;

struct ct_axes axes = ct_axes_from_point(plane_origin,
plane_radius);

struct ct_plot plot;
ct_plot_init(&plot, &axes, &canvas);


ct_test_plane(&plot);


// Our unit circle
ct_circle(&plot, 0+0*I, 1.0, 2048);
ct_circle(&plot, 2+0*I, 2.0, 2048);
ct_circle(&plot, -2+0*I, 2.0, 2048);
ct_circle(&plot, 0+2*I, 2.0, 2048);
ct_circle(&plot, 0-2*I, 2.0, 2048);

ct_canvas_save_ppm(&canvas, "ct_plane.ppm");

ct_canvas_destroy(&canvas);

return EXIT_SUCCESS;
}

return EXIT_FAILURE;
}


____________________________________
Rich
2025-01-06 03:42:01 UTC
Reply
Permalink
Post by Stefan Claas
*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:
Loading Image...

Wikipedia page where the image is linked:
https://en.wikipedia.org/wiki/Electronic_codebook
Stefan Claas
2025-01-06 13:52:38 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
*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
Stefan Claas
2025-01-06 14:04:57 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
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
Stefan Claas
2025-01-06 18:49:01 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
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
Jan Panteltje
2025-01-07 05:56:52 UTC
Reply
Permalink
On a sunny day (Mon, 6 Jan 2025 19:49:01 +0100) it happened Stefan Claas
Post by Stefan Claas
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
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.
Stefan Claas
2025-01-07 16:30:16 UTC
Reply
Permalink
Post by Jan Panteltje
On a sunny day (Mon, 6 Jan 2025 19:49:01 +0100) it happened Stefan Claas
Post by Stefan Claas
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
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.
Well, I could use 'steg' from GitHub, which is another Go program and
allows to hide any data in a .png, for example.
--
Regards
Stefan
Rich
2025-01-06 23:51:12 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
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.
Rich
2025-01-06 22:15:22 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
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.
Stefan Claas
2025-01-07 16:26:48 UTC
Reply
Permalink
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
https://jmp.sh/HZM9ML9f
It includes a padding byte, needed for ppm so that it is divideable by 3.
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
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.
--
Regards
Stefan
Stefan Claas
2025-01-07 21:41:22 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
*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
https://jmp.sh/HZM9ML9f
It includes a padding byte, needed for ppm so that it is divideable by 3.
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
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/LexKevVb
https://github.com/706f6c6c7578/bin2ppm
--
Regards
Stefan
Rich
2025-01-06 03:29:32 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
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?
Rich
2025-01-05 16:30:58 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
Chris M. Thomasson
2025-01-05 22:06:57 UTC
Reply
Permalink
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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...
Chris M. Thomasson
2025-01-05 22:14:08 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.

http://fractallife247.com/test/hmac_cipher/ver_0_0_0_1?ct_hmac_cipher=c9c49b1249a44477e49375ec6a2e1b13c915cd521ba7d47ec4a1f34c678cf052f096b01afbfc67527a2d5388ddfa757ab4264c2b07bbe052f70880e9b00a60b18877c0ea0c9979d453c4c72584f0283d899864
Stefan Claas
2025-01-05 22:18:10 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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
Chris M. Thomasson
2025-01-05 22:35:29 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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...
Rich
2025-01-06 03:50:15 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
Chris M. Thomasson
2025-01-05 22:37:01 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
I should actually join X and see if it allows me to post my ciphertext
links... FB works so far.
Rich
2025-01-06 03:44:43 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Rich
Post by Stefan Claas
Post by Rich
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.
Chris M. Thomasson
2025-01-04 22:41:11 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
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:

Loading Image...

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?

;^)
Chris M. Thomasson
2025-01-04 22:42:07 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
Here is my depth map:

https://www.facebook.com/photo/?fbid=1306311583861170&set=pcb.1306311693861159
Post by Chris M. Thomasson
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?
;^)
Stefan Claas
2025-01-05 00:10:15 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
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
Stefan Claas
2025-01-05 00:02:34 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
Yes, I can see it.
Post by Chris M. Thomasson
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
Stefan Claas
2025-01-05 00:19:05 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
Yes, I can see it.
Post by Chris M. Thomasson
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
Chris M. Thomasson
2025-01-05 03:38:36 UTC
Reply
Permalink
Post by Stefan Claas
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
Yes, I can see it.
Post by Chris M. Thomasson
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.

Loading Image...

https://www.facebook.com/photo/?fbid=135603427598664&set=pcb.135603700931970
Stefan Claas
2025-01-05 09:27:08 UTC
Reply
Permalink
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
Yes, I can see it.
Post by Chris M. Thomasson
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
Chris M. Thomasson
2025-01-05 21:58:16 UTC
Reply
Permalink
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Stefan Claas
Post by Chris M. Thomasson
Post by Stefan Claas
Post by Chris M. Thomasson
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
https://i.ibb.co/gwHwpFL/image.png
Yes, I can see it.
Post by Chris M. Thomasson
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.
Shit happens! :^) For some damn reason I have mine right by my computer.
Strange in a sense. ;^)

Now, think of viewing a "special" stereogram that takes the "special"
depth map's red and blue color channels into account. I think that
viewing the stereogram/anaglyph hybrid thing would simply have to
involve the observer doing the eye thing _while_ wearing the glasses.
Afaict, it should be able to work. I think so.
Loading...