| Deutsch English Français Italiano |
|
<vl4f11$2vav0$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Rich <rich@example.invalid>
Newsgroups: sci.crypt
Subject: Re: Ternary Encoding :-)
Date: Wed, 1 Jan 2025 22:19:13 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <vl4f11$2vav0$2@dont-email.me>
References: <vl243l$3jkpe$1@paganini.bofh.team> <vl3q7v$3mbq0$1@paganini.bofh.team> <vl418a$2sv2k$1@dont-email.me> <vl44rf$3mt70$1@paganini.bofh.team> <vl466f$3mt70$3@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 01 Jan 2025 23:19:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8c10bf53f7fd2c88970ece96e6e64bf0";
logging-data="3124192"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lEz6+4hHXbJy1TiYu1od9"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:UuQ8WwfXnPBeKYQ5LhnF9ZqFoX4=
Bytes: 2694
Stefan Claas <pollux@tilde.club> wrote:
> Stefan Claas wrote:
>> 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).
>
> 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
Or simply "even parity".
https://en.wikipedia.org/wiki/Parity_bit