Starting stream cypher, first block (Salsa20)
I suggest you take a look at the spec of Salsa20. It is quite short and easy to understand. You even have some examples for each component of the implementation.



For more details, you can take a look at this post which explains how to handle different key size (how to treat your initial block, and feed it to the Salsa hash function).