Patented block and stream cipher · protocol diolsa-v4

DIOLSA

A symmetric cipher that hides not only what you say, but how long your messages are, when you send them, and whether you are talking at all.

What it is

A symmetric cipher: both sides share one secret key. It encrypts one byte at a time, so it works for any text in any language, emoji included.

What it hides

The words, the exact length, the moment you send, and whether you are talking at all. Standard ciphers hide only the first.

Where the name comes from

DIO for the linear Diophantine equation that encrypts every byte.

How it works

Three ideas, one cipher

How Gauss's theorem encrypts a byte

The units of a number n are the numbers below n that share no factor with it. Gauss generalised Wilson's theorem by finding what you get when you multiply all the units of n together: always +1 or −1 modulo n. DIOLSA takes the secret key k and multiplies it by 4 or by 15, so that its modulus n = 4k or 15k always lands in the +1 case.

e1 · e2 · e3 · … · eφ(n) ≡ 1  (mod n)
e1 < e2 < … are the units of n in order.

To encrypt a byte b (a number from 0 to 255), DIOLSA multiplies the first b + 1 units and sends the inverse z of that product modulo n. It finds z by solving a linear Diophantine equation. Because the product of all units is 1, z is exactly the product of all the units that were not used: the ciphertext is “everything that is left”.

z ≡ (e1 · e2 · … · eb+1)−1 ≡ eb+2 · … · eφ(n)  (mod n)

The receiver, who knows n, multiplies z by e1, then by e2, and so on, until the result is 1. The number of steps gives back the byte. Without n, z is just a 78-digit number that looks random.

A huge number makes a new key for every byte

The master key only starts the process: it never encrypts a single byte. In each round, the sender picks a random unit ε of n and sends it in secret, each of its 78 digits under its own key. Then both sides multiply the 501 units of n that follow ε:

M = u0 · u1 · u2 · … · u500
u0 = ε. M is never reduced modulo n: it has about 116,500 bits, roughly 35,000 digits.

This giant number M goes through SHA-256 together with secret values, and out come 1000 fresh 256-bit keys, one for each of the next 1000 bytes. Every key brings its own modulus, so each byte is encrypted with a different n. A key is erased the moment it has been used. A separate “next seed”, also made from M, starts the next round. Even someone who breaks into a device later cannot read past messages.

Noise: decoys and the endless stream

A decoy is a random unit z chosen so that its inverse is none of the 256 products the receiver checks. When the receiver tries it, the running product never reaches 1, so the decoy is thrown away and the key chain does not move. To anyone else, a decoy looks exactly like a real tuple. The receiver needs no extra signal to tell them apart.

Try it · encrypt one byte by hand

The one-byte lab

Pick a small key and a character. This runs the real DIOLSA symbol map in your browser. Real keys are 78 digits long; tiny ones just make the numbers easy to read.

Try changing one digit of k: the same character gives a completely different z. In the real cipher, k changes for every byte.

Bob multiplies z by e₁, e₂, e₃ … and stops at the first 1 (highlighted). The number of steps is the byte.

Loading…
Three modes

Choose how much shape to hide

Default

Only real tuples are sent. The words are hidden; the length of each message still shows, as with standard ciphers. Fastest and smallest.

Block mode

Decoys fill every message up to a fixed size, so “yes” and a long paragraph look identical. Longer messages fill the next multiple. A stream cipher that looks like a block cipher.

Stream mode

The line is never quiet. One tuple goes out in every time slot of random length. If a real byte is waiting, it goes; if not, a decoy goes instead. Eve sees the same steady flow whether you type, think, or are gone.

Standard encryption · the size follows the message
“Yes”
3 bytes
“No, sorry, the price is too high”
32 bytes
DIOLSA, block mode · every message is the same size
“Yes”
64 tuples
“No, sorry, the price is too high”
64 tuples
real tupledecoy tuplewhat Eve sees: all alike
Compared

What an eavesdropper learns

The eavesdropper learns…AES-GCM / ChaCha20DIOLSA · blocksDIOLSA · stream
The wordsNoNoNo
The exact lengthYesNo, only the block sizeNo
When a message is sentYesYesNo
Whether anyone is talkingYesYesNo
A changed or missing pieceDetectedDetected, channel closesDetected, channel closes
Features

Built in, not bolted on

Standard ciphers leave length and timing protection to each application. DIOLSA has it in the cipher itself.

A fresh key for every byte

The SHA-256 key chain never reuses a key. Two messages with the same master key never share one, thanks to a random 128-bit nonce.

Forward secrecy

Used keys, digit keys, old seeds and the master key in chat are erased as soon as they are no longer needed.

Tamper seals

Every tuple carries a number and an HMAC seal. A changed, lost, extra or reordered tuple closes the chat at once.

Replay check

Old messages cannot be sent again: anything older than 30 days or replayed is refused.

Any language

Text becomes UTF-8 bytes: a plain letter is 1 tuple, an accented letter 2, most emoji 4.

Key exchange

The master key can come from Diffie-Hellman, ECDH (X25519), a key file, or a long key typed together in person.

The numbers

DIOLSA in figures

Constants of the reference implementation, protocol diolsa-v4.

Alphabet256 symbols (one byte each)
Modulusn = 4k or 15k · 78 digits
Key size256 bits (DH/ECDH) · ≥ 30 digits typed
Chain span501 units per product M
Size of M≈ 116,500 bits
Keys per round1000
Nonce128 random bits
SealsHMAC-SHA256, 128 bits
Message age limit30 days · 5 min clock skew
Honest about security

Open for review

DIOLSA has no security proof yet, and we say so. Good cryptography is tested in public.

The specification reports a first security analysis, including two attacks we ran ourselves on the reference code and a structural weakness in the key chain of the previous version (diolsa-v3) that the current version fixes. With known plaintext, an attacker can recover the key of a single small byte; in diolsa-v4 that key unlocks only that one byte, which the attacker already knew. For printable text we have no attack, and no proof.

We ask cryptographers to read the open questions in the specification and try to break it.

Questions

FAQ

Is DIOLSA a replacement for AES?
No. AES is a well-studied standard. DIOLSA is a new cipher whose strength is hiding the shape of a conversation: length, timing and activity. It is open for review and should be judged on that review.
Doesn't stream mode use more data?
Yes. Hiding when you talk means sending tuples even when you are silent, so stream mode uses more data and battery. You choose the rate. Block mode is the middle ground.
How does the receiver know which tuples are decoys?
A decoy is built so that its running product never reaches 1 under the current key. The receiver tries it, sees it fail, throws it away and does not move the key chain. No extra signal is needed, and the decoy looks just like a real tuple to everyone else.
Why multiply k by 4 or 15?
Gauss's theorem gives −1 for some moduli and +1 for others. For every k > 1, 4k and 15k always give +1, even when k is prime. That makes the ciphertext exactly “the product of the units that are left”.
What if someone steals my phone later?
Every key is erased right after use, and the next round's seed is made separately. Someone who breaks in later cannot rebuild the keys of messages already sent.
Can I use it today?
Yes: Shhh is a chat app where every conversation is encrypted with DIOLSA. You can also play with the live demo.
Live demo · runs in your browser

Watch Eve see nothing

Alice and Bob chat with DIOLSA. Press EVE to see only what an eavesdropper sees on the wire. Switch between default, block and stream mode and watch the shape of the conversation disappear.