Sujet : Re: Ternary Encoding :-)
De : pollux (at) *nospam* tilde.club (Stefan Claas)
Groupes : sci.cryptDate : 01. Jan 2025, 20:25:34
Autres entêtes
Organisation : To protect and to server
Message-ID : <vl44rf$3mt70$1@paganini.bofh.team>
References : 1 2 3
User-Agent : flnews/1.3.0pre29 (for GNU/Linux)
Rich wrote:
Stefan Claas <pollux@tilde.club> wrote:
Stefan Claas wrote:
echo 'Happy News Year 2025' | ternary
2112102022020111101010222211010022112012102120110020100021120220
10000111010121200020221000211000220022020
$ echo 'Happy News Year 2025' | ternary | ternary -d
Happy News Year 2025
(My program works with binary data as well.)
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.
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/ Of course, this just brings to the front the OTP key distribution and
key reuse problems.
Use it locally with your best friends. :-)
-- RegardsStefan