code: function Salsa20(key, nonce) {
      // Constants.
      this.rounds = 20; // number of Salsa rounds
      this.sigmaWords = [0x61707865, 0x3320646e, 0x79622d32, 0x6b206574];
  
      // State.
      this.keyWords = [];           // key words
      this.nonceWords = [0, 0];     // nonce words
      this.counterWords = [0, 0];   // block counter words
  
      // Output buffer.
      this.block = [];        // output block of 64 bytes
      this.blockUsed = 64;     // number of block bytes used
  
      this.setKey(key);
      this.setNonce(nonce);
  }
docs: code from this gist: https://gist.github.com/dchest/4582374 (no license declared)