public void chat(BigInteger K, boolean init) {
        try {

            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String line;
            BigInteger tmp;

            if(init) {
                // yeah yeah, code duplication... this saves runtime, one if per loop!
                line = in.readLine();
                if(line == null) {
                    return;
                }
                tmp = new BigInteger(line.getBytes());
                tmp = crypt(K, tmp);
                com.sendTo(init ? 1 : 0, tmp.toString(16));
            }

            while(true) {

                line = com.receive();
                tmp = new BigInteger(line, 16);
                tmp = decrypt(K, tmp);
                System.out.println(new String(tmp.toByteArray()));

                line = in.readLine();
                if(line == null) {
                    return;
                }
                tmp = new BigInteger(line.getBytes());
                tmp = crypt(K, tmp);
                com.sendTo(init ? 1 : 0, tmp.toString(16));

            }

        } catch(IOException e) {
            e.printStackTrace();
            System.exit(0);
        }

    }