lib/tweetnacl-fast.js
function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  var z = new Uint8Array(16), x = new Uint8Array(64);
  var u, i;
  for (i = 0; i < 16; i++) z[i] = 0;
  for (i = 0; i < 8; i++) z[i] = n[i];
  while (b >= 64) {
    crypto_core_salsa20(x,z,k,sigma);
    for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
    u = 1;
    for (i = 8; i < 16; i++) {
      u = u + (z[i] & 0xff) | 0;
      z[i] = u & 0xff;
      u >>>= 8;
    }
    b -= 64;
    cpos += 64;
    mpos += 64;
  }
  if (b > 0) {
    crypto_core_salsa20(x,z,k,sigma);
    for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  }
  return 0;
}
function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  var z = new Uint8Array(16), x = new Uint8Array(64);
  var u, i;
  for (i = 0; i < 16; i++) z[i] = 0;
  for (i = 0; i < 8; i++) z[i] = n[i];
  while (b >= 64) {
    crypto_core_salsa20(x,z,k,sigma);
    for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
    u = 1;
    for (i = 8; i < 16; i++) {
      u = u + (z[i] & 0xff) | 0;
      z[i] = u & 0xff;
      u >>>= 8;
    }
    b -= 64;
    cpos += 64;
    mpos += 64;
  }
  if (b > 0) {
    crypto_core_salsa20(x,z,k,sigma);
    for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  }
  return 0;
}
function crypto_stream_salsa20_xor ( c , cpos , m , mpos , b , n , k ) { var z = new Uint8Array ( 16 ) , x = new Uint8Array ( 64 ) ; var u , i ; for ( i = 0 ; i < 16 ; i ++ ) z [ i ] = 0 ; for ( i = 0 ; i < 8 ; i ++ ) z [ i ] = n [ i ] ; while ( b >= 64 ) { crypto_core_salsa20 ( x , z , k , sigma ) ; for ( i = 0 ; i < 64 ; i ++ ) c [ cpos + i ] = m [ mpos + i ] ^ x [ i ] ; u = 1 ; for ( i = 8 ; i < 16 ; i ++ ) { u = u + ( z [ i ] & 0xff ) | 0 ; z [ i ] = u & 0xff ; u >>>= 8 ; } b -= 64 ; cpos += 64 ; mpos += 64 ; } if ( b > 0 ) { crypto_core_salsa20 ( x , z , k , sigma ) ; for ( i = 0 ; i < b ; i ++ ) c [ cpos + i ] = m [ mpos + i ] ^ x [ i ] ; } return 0 ; }
"expand 32-byte k"
expand 32 - byte k