public function setKey($key)
    {
        $this->nk     = strlen($key) / 4;
        $this->rounds = $this->nk + self::$nb + 2;

        if ($this->nk != 4 && $this->nk != 6 && $this->nk != 8) {
            throw new Doozr_Crypt_Service_Exception(
                sprintf('Key is %s bits long. *not* 128, 192, or 256.', ($this->nk * 32))
            );
        }

        $this->rounds = $this->nk + self::$nb + 2;
        $this->word   = []; // Nb*(Nr+1) 32-bit words
        $this->state  = [[]]; // 2-D array of Nb colums and 4 rows

        $this->KeyExpansion($key); // places expanded key in w
    }