Score:0

Can salt and XOF be used to create a symmetric cipher?

eu flag

I'm new to crypto, and I've got an idea and I want to get some feedback if it's even a right direction. Let's say that I create a symmetric cipher by using an XOF with a salt and a secret key.

Something like that.

XOR(XOF(salt, secret), plaintext)

When I want to send somebody an encrypted message, I will send both the salt and the ciphertext.

How to break this encryption?

Likepineapple avatar
eu flag
One weakness is that this is not authenticated, and the message might be modified without our knowledge. I can prevent this by generating a MAC. Something along the lines: MAC(message, another secret) and sending it along the message as well.
Morrolan avatar
ng flag
See [this answer](https://crypto.stackexchange.com/questions/99185/can-you-use-shake256-xof-with-xor-to-make-a-stream-cipher) and the paper it links to, specifically its section on turning an XOF into a stream cipher. In a nutshell: Yes, this works.
Maarten Bodewes avatar
in flag
To me that's a clear answer to the question. Please note that a XOF takes two output parameters: a message and an output size (although the output size is usually determined by taking as much bytes as you need). You are redefining the XOF to have a salt and a secret as input parameters. In the linked to answer you can regard the "nonce" to be the salt and nonce is probably the better term when you are defining a cipher. Please indicate if anything is missing from that answer, for now I'll close it.
Maarten Bodewes avatar
in flag
Oh, one additional remark, there have been multiple (authenticated) ciphers defined using e.g. the Keccak sponge function. It is highly recommended to check those out instead of creating your own scheme.
Likepineapple avatar
eu flag
Thank you. This is really helpful.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.