Score:2

Salsa20 encryption process

cn flag

I am studying the Salsa20 algorithm and I was wondering if you could help me understanding the expansion function. I don´t understand what the Pos or stream position as I have read in other places does, is it meant to randomize the data, similar to the nonce? Any help would be greatly appreciated!

Initial state

Score:1
cn flag

The intent is that you choose a random key and use it to encrypt messages, whatever "message" may mean to your application. After each 512-bit block you increment the position, and after each message you increment the nonce and reset the position to 0.

There's nothing in Salsa20's design that requires you to use fields of those sizes for those purposes, since they're all hashed in the same way, but following the recommendation minimizes the chance that you'll inadvertently use the same initial state for two different blocks, which would leak plaintext.

Neither the nonce nor the position is meant to add randomness, just uniqueness. They're too short to be safely chosen at random. There are Salsa/ChaCha variants with a longer nonce if you need it to be random.

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.