public static boolean attempt(BufferedReader input, BufferedWriter output, Scanner sc) throws IOException
	{
		output.write("HELLO\n");
		output.flush();
		String s, t;
		s=input.readLine();
		if(!s.equals("HELLO. WHO ARE YOU?")){
			System.out.println("PROTOCOL FAILED");
			input.close();
			output.close();
			return false;
		}
		
		while(true)
		{
			System.out.println("login: ");
			s = sc.nextLine();
			output.write("LOGIN: " + s + "\n");
			output.flush();
			s = input.readLine();
			if(s.equals("LOGIN DOES NOT EXIST"))
			{
				System.out.println("LOGIN DOES NOT EXIST!");
				continue;
			}
			Pattern pat = Pattern.compile("-?\\d+");
			Matcher mat = pat.matcher(s); 
			byte[] salt = new byte[8];
			byte[] encPass = null;
			for (int j=0; j<8; j++)
			{
				if(!mat.find())
					throw new IOException("salt table too short");
				salt[j] = new Byte(mat.group());
			}
			
			System.out.println("password: ");
			s = sc.nextLine();			
			try {
				encPass = PasswordEncryption.getEncryptedPassword(s, salt);
			} catch (Exception e){
				e.printStackTrace();
			}
			output.write("PASS: ");
			for (int j=0; j<encPass.length; j++)
				output.write(new Byte(encPass[j]).toString() + " ");
			output.write("\n");
			output.flush();
			s = input.readLine();
			if(s.equals("LOGIN OK")){
				return true;
			}
			System.out.println("WRONG PASSWORD!");
		}
	}