       @input[i+11] = A[i]
     for i in [0...4]
       @input[i*5] = C.words[i]
+
+  #--------------
 
   _fix_key : () ->
     keysize = 32

    @sigma = new WordArray [0x61707865, 0x3320646e, 0x79622d32, 0x6b206574], 4*4
    @_reset()

  key_setup : () ->
    for i in [0...4]
      @input[i+1] = @key.words[i]

  # _generateBlock generates 64 bytes from key, nonce, and counter,
  # and puts the result into this.block.
  _generateBlock : ->
    x0  = @input[0]
    x1  = @input[1]
    x2  = @input[2]
    x3  = @input[3]
    x4  = @input[4]
    x5  = @input[5]
    x6  = @input[6]
    x7  = @input[7]
    x8  = @input[8]
    x9  = @input[9]
    x10 = @input[10]
    x11 = @input[11]
    x12 = @input[12]
    x13 = @input[13]
    x14 = @input[14]
    x15 = @input[15]

    for i in [0...@rounds] by 2
      u = x0 + x12;    x4  ^= (u<<7)  | (u>>>(32-7))
      u = x4 + x0;     x8  ^= (u<<9)  | (u>>>(32-9))
      u = x8 + x4;     x12 ^= (u<<13) | (u>>>(32-13))
      u = x12 + x8;    x0  ^= (u<<18) | (u>>>(32-18))
      u = x5 + x1;     x9  ^= (u<<7)  | (u>>>(32-7))
      u = x9 + x5;     x13 ^= (u<<9)  | (u>>>(32-9))
      u = x13 + x9;    x1  ^= (u<<13) | (u>>>(32-13))
      u = x1 + x13;    x5  ^= (u<<18) | (u>>>(32-18))
      u = x10 + x6;    x14 ^= (u<<7)  | (u>>>(32-7))
      u = x14 + x10;   x2  ^= (u<<9)  | (u>>>(32-9))
      u = x2 + x14;    x6  ^= (u<<13) | (u>>>(32-13))
      u = x6 + x2;     x10 ^= (u<<18) | (u>>>(32-18))
      u = x15 + x11;   x3  ^= (u<<7)  | (u>>>(32-7))
      u = x3 + x15;    x7  ^= (u<<9)  | (u>>>(32-9))
      u = x7 + x3;     x11 ^= (u<<13) | (u>>>(32-13))
      u = x11 + x7;    x15 ^= (u<<18) | (u>>>(32-18))
      u = x0 + x3;     x1  ^= (u<<7)  | (u>>>(32-7))
      u = x1 + x0;     x2  ^= (u<<9)  | (u>>>(32-9))
      u = x2 + x1;     x3  ^= (u<<13) | (u>>>(32-13))
      u = x3 + x2;     x0  ^= (u<<18) | (u>>>(32-18))
      u = x5 + x4;     x6  ^= (u<<7)  | (u>>>(32-7))
      u = x6 + x5;     x7  ^= (u<<9)  | (u>>>(32-9))
      u = x7 + x6;     x4  ^= (u<<13) | (u>>>(32-13))
      u = x4 + x7;     x5  ^= (u<<18) | (u>>>(32-18))
      u = x10 + x9;    x11 ^= (u<<7)  | (u>>>(32-7))
      u = x11 + x10;   x8  ^= (u<<9)  | (u>>>(32-9))
      u = x8 + x11;    x9  ^= (u<<13) | (u>>>(32-13))
      u = x9 + x8;     x10 ^= (u<<18) | (u>>>(32-18))
      u = x15 + x14;   x12 ^= (u<<7)  | (u>>>(32-7))
      u = x12 + x15;   x13 ^= (u<<9)  | (u>>>(32-9))
      u = x13 + x12;   x14 ^= (u<<13) | (u>>>(32-13))
      u = x14 + x13;   x15 ^= (u<<18) | (u>>>(32-18))

    x0  += @input[0]
    x1  += @input[1]
    x2  += @input[2]
    x3  += @input[3]
    x4  += @input[4]
    x5  += @input[5]
    x6  += @input[6]
    x7  += @input[7]
    x8  += @input[8]
    x9  += @input[9]
    x10 += @input[10]
    x11 += @input[11]
    x12 += @input[12]
    x13 += @input[13]
    x14 += @input[14]
    x15 += @input[15]

    @block[ 0] = ( x0 >>>  0) & 0xff; @block[ 1] = ( x0 >>>  8) & 0xff;
    @block[ 2] = ( x0 >>> 16) & 0xff; @block[ 3] = ( x0 >>> 24) & 0xff;
