public byte[] encryptBlock(byte[] input, byte[] key) {

        isKeyValid(key);

        if (input.length < 16) {
            throw new IllegalArgumentException("Cannot encrypt input shorter than 16 bytes(block).");
        }

        byte[] result = new byte[16];
        byte[][] expandedKey = keyExpansion(key);

        //prepare stateMatrix
        byte[][] stateMatrix = new byte[4][4];
        for (int x = 0; x < 4; x++) {
            for (int y = 0; y < 4; y++) {
                stateMatrix[x][y] = input[(4 * x) + y];
            }
        }

        //InitialRound
        stateMatrix = addRoundKey(expandedKey, stateMatrix, 0);

        for (int round = 1; round <= numOfRounds(key); round++) {

            //Encription step 1: subBytes operation
            stateMatrix = subBytes(stateMatrix);

            //Encription step 2: shiftRows operation
            stateMatrix = shiftRows(stateMatrix);

            //Encription step 3: mixColumns operation
            if (round != numOfRounds(key)) {
                stateMatrix = mixColumns(stateMatrix);
            }

            //Encription step 4: addRoundKey operation
            stateMatrix = addRoundKey(expandedKey, stateMatrix, round);
        }

        //prepare result
        for (int x = 0; x < 16; x++) {
            result[x] = stateMatrix[x / 4][x % 4];
        }


        return result;
    }