     @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 = j0 = @sigma.words[0]
    x1 = j1 = @key.words[0]
    x2 = j2 = @key.words[1]
    x3 = j3 = @key.words[2]
    x4 = j4 = @key.words[3]
    x5 = j5 = @sigma.words[1]
    x6 = j6 = @nonce.words[0]
    x7 = j7 = @nonce.words[1]
    x8 = j8 = @counter.get().words[0]
    x9 = j9 = @counter.get().words[1]
    x10 = j10 = @sigma.words[2]
    x11 = j11 = @key.words[4]
    x12 = j12 = @key.words[5]
    x13 = j13 = @key.words[6]
    x14 = j14 = @key.words[7]
    x15 = j15 = @sigma.words[3]

    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 += j0
    x1 += j1
    x2 += j2
    x3 += j3
    x4 += j4
    x5 += j5
    x6 += j6
    x7 += j7
    x8 += j8
    x9 += j9
    x10 += j10
    x11 += j11
    x12 += j12
    x13 += j13
    x14 += j14
    x15 += j15

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

      @input[i+11] = A[i]
    for i in [0...4]
      @input[i*5] = C.words[i]

  #--------------

  _fix_key : () ->
    keysize = 32
